tiredofit / docker-traefik-cloudflare-companion

Automatically Create CNAME records for containers served by Traefik

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: object of type 'NoneType' has no len()

mp-strachan opened this issue · comments

Summary

Container kept crashing when trying to create a new record.

Relevant logs and/or screenshots

Empty records causing a type error:

TypeError: object of type 'NoneType' has no len()

Possible fixes

If appears that line #176 (records = cf.zones.dns_records.get(domain_info['zone_id'], params={u'name': name})) is returning an empty object if searched record does not exist. When evaluating the length in line #186 (if len(records) == 0:) a type error is thrown.

Adding a type check resolved the issue. if (records is None or len(records) == 0):