Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDFLAREAPI: Exit code 0 even if ending with ERROR due to invalid API token #2474

Open
apoeteo opened this issue Jul 7, 2023 · 1 comment

Comments

@apoeteo
Copy link

apoeteo commented Jul 7, 2023

Describe the bug
With CLOUDFLAREAPI, even if an invalid API token is used and preview ends with "ERROR", the exit code is 0.
That's especially confusing when using in a pipeline.

To Reproduce

  1. Use an invalid API token in "creds.json"
  2. Run docker run --rm -it -v $(pwd)/dnsconfig.js:/dns/dnsconfig.js -v $(pwd)/creds.json:/dns/creds.json -v $(pwd)/spfcache.updated.json:/dns/spfcache.updated.json -v $(pwd)/spfcache.json:/dns/spfcache.json -v $(pwd)/zones/:/dns/zones/ -u $(id -u ${USER}):$(id -g ${USER}) stackexchange/dnscontrol preview
  3. The output is "ERROR: ERROR: failed fetching domain list from cloudflare(""): Invalid access token (9109)Done. 0 corrections." but the exit code is 0.

Same issue happens if you forget to whitelist your IP on CloudFlare and attempt to connect there. The output is "ERROR: ERROR: failed fetching domain list from cloudflare(""): Cannot use the access token from location: XXX.XXX.XXX.XXX (9109)Done. 0 corrections." but the exit code is 0.

If you try to run the command without a token (token field empty), the exit code is 1.

Expected behavior
There should be an error exit code, the same like if you run with empty token field.

DNS Provider
CLOUDFLAREAPI

Additional context
When used in a GitLab pipeline, it's confusing when the preview job ends with success even though it was no successful.

@TomOnTime
Copy link
Collaborator

CC @tresni

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants