octodns / octodns-bind

RFC compliant (Bind9) provider for octoDNS
MIT License
7 stars 10 forks source link

It is not possible to put the port number in variable #17

Closed Marthym closed 1 year ago

Marthym commented 1 year ago

Hi, thank you for the work it's really usefull for me to be able to update zones from our git repository 👍

I would like to use an env variable to set the port for the DNS. But with this configuration a have an error :

  rfc2136:
    class: octodns_bind.Rfc2136Provider
    host: env/DNS_HOST
    port: env/DNS_PORT  <<== A number is set inside this var (5353)
    key_name: env/DNS_KEY
    key_secret: env/DNS_SECRET
    key_algorithm: hmac-sha256
Traceback (most recent call last):
  File "/builds/BotDesign/infra/octodns/venv/bin/octodns-sync", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/builds/BotDesign/infra/octodns/venv/lib/python3.11/site-packages/octodns/cmds/sync.py", line 57, in main
    manager.sync(
  File "/builds/BotDesign/infra/octodns/venv/lib/python3.11/site-packages/octodns/manager.py", line 592, in sync
    ps, d = future.result()
            ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builds/BotDesign/infra/octodns/venv/lib/python3.11/site-packages/octodns/manager.py", line 435, in _populate_and_plan
    plan = target.plan(zone, processors=processors)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builds/BotDesign/infra/octodns/venv/lib/python3.11/site-packages/octodns/provider/base.py", line 178, in plan
    exists = self.populate(existing, target=True, lenient=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builds/BotDesign/infra/octodns/venv/lib/python3.11/site-packages/octodns_bind/__init__.py", line 53, in populate
    rrs = self.zone_records(zone)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/builds/BotDesign/infra/octodns/venv/lib/python3.11/site-packages/octodns_bind/__init__.py", line 184, in zone_records
    z = dns.zone.from_xfr(
        ^^^^^^^^^^^^^^^^^^
  File "/builds/BotDesign/infra/octodns/venv/lib/python3.11/site-packages/dns/zone.py", line 1369, in from_xfr
    for r in xfr:
  File "/builds/BotDesign/infra/octodns/venv/lib/python3.11/site-packages/dns/query.py", line 1229, in xfr
    _connect(s, destination, expiration)
  File "/builds/BotDesign/infra/octodns/venv/lib/python3.11/site-packages/dns/query.py", line 869, in _connect
    err = s.connect_ex(address)
          ^^^^^^^^^^^^^^^^^^^^^
TypeError: 'str' object cannot be interpreted as an integer

Thanks for your help.

Regards,

yzguy commented 1 year ago

Ah, that makes sense, we will need to type cast it to int. Will have a PR here in a few.

Think it never really came up because it's not a secret so never tried putting it in an environment variable, just hardcoded it in the config.

yzguy commented 1 year ago

19 is merged to fix this, you can install this version following these instructions

I'll work on getting a real release out, but might try and roll the fix for #18 into it too

Marthym commented 1 year ago

Thanks for this really fast response

yzguy commented 1 year ago

@Marthym This fix is in v0.0.3 release of the provider