Skip to content

Crashes if domain does not exist #35

@Naozumi

Description

@Naozumi

Issue: If a domain is missing from CloudFlare then the hook crashes, taking out the ongoing process and preventing attempts for other domains.

Cause: It might seem odd one but I host website for other people and sometimes they remove the site without warning, as happened with one site. The issue then was that when my cron task checked the domain list that included this domain and others it would try this problematic domain and CloudFlare had removed the site. The hook.py then crashed and all other domains in my domain list file get ignored.

Proposed Fix: If CloudFlare returns a null for a website, fail the verification rather than crashing so other sites can still be processed correctly.

Stack Trace:
Traceback (most recent call last):
File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 203, in <module>
main(sys.argv[1:])
File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 199, in main
ops[argv[0]](argv[1:])
File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 167, in create_all_txt_records
create_txt_record(args[i:i+X])
File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 105, in create_txt_record
zone_id = _get_zone_id(domain)
File "/data/am/dehydrated/hooks/cloudflare/hook.py", line 83, in _get_zone_id
return r.json()['result'][0]['id']
IndexError: list index out of range

Config File:
CHALLENGETYPE="dns-01"
DOMAINS_TXT="${BASEDIR}/domains"
HOOK="/data/am/dehydrated/hooks/cloudflare/hook.py"
CONTACT_EMAIL="x@y"
export CF_EMAIL=x@y
export CF_KEY=12345

Domains File:
working.com www.working.com
autoremovedfromcloudflare.com www.autoremovedfromcloudflare.com
example.com www.example.com
In this Domains File example.com is never processed due to crash with previous domain

Hope this makes sense. And thank you for your script - it's an amazing help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions