timothymiller/cloudflare-ddns

v.1.0.3 Multiple errors in logs.

Closed this issue · 3 comments

Describe the bug

Docker log show multiple instances of errors repeatedly as follows:

KeyError: 'load_balancer'
🕰️ Updating IPv4 (A) records every 300 seconds
Traceback (most recent call last):
File "/cloudflare-ddns.py", line 306, in
updateIPs(getIPs())
File "/cloudflare-ddns.py", line 245, in updateIPs
updateLoadBalancer(ip)
File "/cloudflare-ddns.py", line 191, in updateLoadBalancer
for option in config["load_balancer"]:
~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'load_balancer'
🕰️ Updating IPv4 (A) records every 300 seconds
Traceback (most recent call last):
File "/cloudflare-ddns.py", line 306, in
updateIPs(getIPs())
File "/cloudflare-ddns.py", line 245, in updateIPs
updateLoadBalancer(ip)
File "/cloudflare-ddns.py", line 191, in updateLoadBalancer
for option in config["load_balancer"]:

To Reproduce

Run the latest release image. Note: This is without using the load balancing option in config.json .

Pull the docker logs via:

docker logs -f <cloudflare-ddns-container-name>

Expected behavior

There should not be any errors, except for

🕰️ Updating IPv4 (A) records every 300 seconds

This release seems to update the IP successfully albeit with the above-mentioned errors.

Would also appreciate if previous releases are available to revert to.

Pushed a change to comment out the load balancer updating part for now.

Will revisit this later tonight.

Thanks for reporting this @orpheus1120 🙏🏻

I also have errors:

Traceback (most recent call last):
  File "/cloudflare-ddns.py", line 306, in <module>
    updateIPs(getIPs())
  File "/cloudflare-ddns.py", line 244, in updateIPs
    commitRecord(ip)
  File "/cloudflare-ddns.py", line 124, in commitRecord
    response = cf_api("zones/" + option['zone_id'], "GET", option)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cloudflare-ddns.py", line 210, in cf_api
    api_token = config['authentication']['api_token']
                ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'api_token'

My config:

{
  "cloudflare": [
    {
      "authentication": {
        "api_key": {
          "api_key": "<my_Key>",
          "account_email": "<my_Mail"
        }
      },
      "zone_id": "<my_ID>",
      "subdomains": [
        {
          "name": "xyz"
        },
        {
          "name": "xyz4"
        },
        {
          "name": "xyz6"
        }
      ]
    }
  ],
  "a": true,
  "aaaa": true,
  "purgeUnknownRecords": false,
  "ttl": 300
}

Edit:

I had to add the 'api_token' line with an empty value and also the proxy false setting in every subdomain entry. Than it worked for me.