0

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

但是,当我尝试使用 octodns 添加新区域时,它会失败并出现以下错误。理想情况下,octodns 应该在数据库中创建区域的条目,并为其创建 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.
4

1 回答 1

0

我猜您正在使用带有旧 octodns 的 powerdns 4.2+。行为已更改。

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

octodns 在 6 个月前修复了这个问题,这可能会在 0.9.11 中修复。

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

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

于 2020-12-08T07:37:04.183 回答