Octodns无法向使用mysql后端运行的powerdns添加新区域

时间:2019-12-17 11:20:56

标签: powerdns

我正在使用mysql后端运行powerdns。

但是,当我尝试使用八位字节添加新区域时,它失败并显示以下错误。理想情况下,八位字节应该在数据库中创建区域的条目,并为其创建SOA记录。

任何人都可以帮助吗?

$ octodns-sync --config=./config/dev.yaml --debug --doit
2019-12-17T06:53:45 [140647765260032] INFO Manager init: config_file=./config/dev.yaml
2019-12-17T06:53:45 [140647765260032] INFO Manager init: max_workers=1
2019-12-17T06:53:45 [140647765260032] INFO Manager init: max_workers=False
2019-12-17T06:53:45 [140647765260032] DEBUG Manager init: configuring providers
2019-12-17T06:53:45 [140647765260032] DEBUG PowerDnsProvider[powerdns] init: id=powerdns, host=localhost, port=8081, nameserver_values=None, nameserver_ttl=600
2019-12-17T06:53:45 [140647765260032] DEBUG PowerDnsProvider[powerdns] init: id=powerdns, apply_disabled=False, update_pcent_threshold=0.30, delete_pcent_threshold=0.30
2019-12-17T06:53:45 [140647765260032] DEBUG YamlProvider[config] init: id=config, directory=./config, default_ttl=3600, enforce_order=1
2019-12-17T06:53:45 [140647765260032] DEBUG YamlProvider[config] init: id=config, apply_disabled=False, update_pcent_threshold=0.30, delete_pcent_threshold=0.30
2019-12-17T06:53:45 [140647765260032] INFO Manager sync: eligible_zones=[], eligible_targets=[], dry_run=False, force=False
2019-12-17T06:53:45 [140647765260032] INFO Manager sync: zone=example.com.
2019-12-17T06:53:45 [140647765260032] INFO Manager sync: sources=['config'] -> targets=['powerdns']
2019-12-17T06:53:45 [140647765260032] DEBUG Manager sync: populating, zone=example.com.
2019-12-17T06:53:45 [140647765260032] DEBUG Manager configured_sub_zones: subs=dict_keys([])
2019-12-17T06:53:45 [140647765260032] DEBUG Zone init: zone=Zone<example.com.>, sub_zones=set()
2019-12-17T06:53:45 [140647765260032] DEBUG YamlProvider[config] populate: name=example.com., target=False, lenient=False
2019-12-17T06:53:45 [140647765260032] DEBUG Record init: zone.name=example.com., type= ARecord, name=
2019-12-17T06:53:45 [140647765260032] DEBUG YamlProvider[config] _populate_from_file: successfully loaded "./config/example.com.yaml"
2019-12-17T06:53:45 [140647765260032] INFO YamlProvider[config] populate: found 1 records, exists=False
2019-12-17T06:53:45 [140647765260032] DEBUG Manager sync: planning, zone=example.com.
2019-12-17T06:53:45 [140647765260032] INFO PowerDnsProvider[powerdns] plan: desired=example.com.
2019-12-17T06:53:45 [140647765260032] DEBUG Zone init: zone=Zone<example.com.>, sub_zones=set()
2019-12-17T06:53:45 [140647765260032] DEBUG PowerDnsProvider[powerdns] populate: name=example.com., target=True, lenient=True
2019-12-17T06:53:45 [140647765260032] DEBUG PowerDnsProvider[powerdns] _request: method=GET, path=zones/example.com.
2019-12-17T06:53:45 [140647765260032] DEBUG urllib3.connectionpool Starting new HTTP connection (1): localhost:8081
2019-12-17T06:53:45 [140647765260032] DEBUG urllib3.connectionpool http://localhost:8081 "GET /api/v1/servers/localhost/zones/example.com. HTTP/1.1" 404 9
2019-12-17T06:53:45 [140647765260032] DEBUG PowerDnsProvider[powerdns] _request: status=404
Traceback (most recent call last):
File "/home/sam/dns/env/bin/octodns-sync", line 8, in
sys.exit(main())
File "/home/sam/dns/env/lib/python3.5/site-packages/octodns/cmds/sync.py", line 39, in main
dry_run=not args.doit, force=args.force)
File "/home/sam/dns/env/lib/python3.5/site-packages/octodns/manager.py", line 315, in sync
plans = [p for f in futures for p in f.result()]
File "/home/sam/dns/env/lib/python3.5/site-packages/octodns/manager.py", line 315, in
plans = [p for f in futures for p in f.result()]
File "/home/sam/dns/env/lib/python3.5/site-packages/octodns/manager.py", line 56, in result
return self.func(*self.args, **self.kwargs)
File "/home/sam/dns/env/lib/python3.5/site-packages/octodns/manager.py", line 243, in _populate_and_plan
plan = target.plan(zone)
File "/home/sam/dns/env/lib/python3.5/site-packages/octodns/provider/base.py", line 51, in plan
exists = self.populate(existing, target=True, lenient=True)
File "/home/sam/dns/env/lib/python3.5/site-packages/octodns/provider/powerdns.py", line 174, in populate
resp = self._get('zones/{}'.format(zone.name))
File "/home/sam/dns/env/lib/python3.5/site-packages/octodns/provider/powerdns.py", line 46, in _get
return self._request('GET', path, data=data)
File "/home/sam/dns/env/lib/python3.5/site-packages/octodns/provider/powerdns.py", line 42, in _request
resp.raise_for_status()
File "/home/sam/dns/env/lib/python3.5/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://localhost:8081/api/v1/servers/localhost/zones/example.com.

1 个答案:

答案 0 :(得分:0)

我猜您正在将Powerdns 4.2+与旧的八位字节一起使用。行为已更改。

它曾经针对不存在的区域返回402,但现在返回404。

此八个月前已修复八位字节,可能在0.9.11中已修复。

如果没有,您可以在master中遵循此代码并将其修补到同一文件中。

https://github.com/github/octodns/blame/master/octodns/provider/powerdns.py#L224