infothrill / python-dyndnsc

dynamic dns (dyndns) update client with support for multiple protocols
https://pypi.org/project/dyndnsc/
MIT License
38 stars 17 forks source link

AttributeError: 'IPDetectorWebCheck' object has no attribute 'names' #144

Closed makuser closed 3 years ago

makuser commented 3 years ago

I am having problems keeping the ip addresses updated on one of my Raspberry Pi setups. Sometimes they do not even get updated at all, the easiest way for me is to trigger a reboot of the device, so that I am able to access it from the outside again. This usually works, but I noticed some errors in the logs. I am calling dyndnsc via dhcpd hooks, to react directly on any changes on my networking interfaces, but also via crontab as a fallback every 11th minute of every hour. I assume the errors occur because the interfaces have no IP at the time that I am calling dyndnsc, but even in that case the dyndns entry should be updated as well and set to no IP/delete the IP.

/etc/dyndnsc.ini:

[dyndnsc]
configs = myconf_ipv4, myconf_ipv6

[myconf_ipv4]
# this will update your ipv4 address to the address
# the detector dnswanip returns:
use_preset = nsupdate.info:ipv4
updater-url = https://ipv4.mynsupdateinfosetup.tld/nic/update
updater-hostname = myclient.mynsupdateinfosetup.tld
updater-userid = myclient.mynsupdateinfosetup.tld
updater-password = mypassword
detector = webcheck4
detector-url = http://ipv4.mynsupdateinfosetup.tld/myip
#detector-parser = plain

[myconf_ipv6]
# this will update your ipv6 address to the address
# the detector dnswanip returns:
use_preset = nsupdate.info:ipv6
updater-url = https://ipv6.mynsupdateinfosetup.tld/nic/update
updater-hostname = myclient.mynsupdateinfosetup.tld
updater-userid = myclient.mynsupdateinfosetup.tld
updater-password = mypassword
detector = socket
detector-family = INET6
#detector = webcheck6
#detector-url = http://ipv6.mynsupdateinfosetup.tld/myip
#detector-parser = plain

I used the webcheck6 detector before, but that yielded different errors, so I commented that and tried the socket detector. Logs are from that very config right there.

/etc/dhcp/dhclient-exit-hooks.d/dyndns:

/usr/local/bin/dyndnsc --config /etc/dyndnsc.ini

crontab:

# m h  dom mon dow   command
11 * * * * /usr/local/bin/dyndnsc --config /etc/dyndnsc.ini

journalctl:

Mär 29 11:17:06 server dhcpcd[343]: Traceback (most recent call last):
Mär 29 11:17:06 server dhcpcd[343]:   File "/usr/local/bin/dyndnsc", line 10, in <module>
Mär 29 11:17:06 server dhcpcd[343]:     sys.exit(main())
Mär 29 11:17:06 server dhcpcd[343]:   File "/usr/local/lib/python3.7/dist-packages/dyndnsc/cli.py", line 189, in main
Mär 29 11:17:06 server dhcpcd[343]:     dyndnsclient.sync()
Mär 29 11:17:06 server dhcpcd[343]:   File "/usr/local/lib/python3.7/dist-packages/dyndnsc/core.py", line 71, in sync
Mär 29 11:17:06 server dhcpcd[343]:     LOG.debug("Couldn't detect the current IP using detector %r", self.detector.names()[-1])
Mär 29 11:17:06 server dhcpcd[343]: AttributeError: 'IPDetectorWebCheck' object has no attribute 'names'
makuser commented 3 years ago

Great work+fast reaction! This should get rid of the traceback, since it is no longer trying to access the attribute names in the logger👌🏻