Closed quistian closed 1 year ago
I believe Cloudflare switched it's auth setup at some point in the past, but I don't recall the details. If what you're using is something CF is calling a token you might try removing the email part, my CF provider config looks like:
cloudflare:
class: octodns_cloudflare.CloudflareProvider
token: env/CLOUDFLARE_TOKEN
That's what I have locally and it's working for me.
When both email & token are set it does the auth-key method, when there's just a token it uses standard http auth mechanisms.
Facing a similar issue as of OctoDNS version 1.0.0
. Version 0.9.2
is working fine:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.5/x64/bin/octodns-sync", line 8, in <module>
sys.exit(main())
^^^^^^
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/octodns/cmds/sync.py", line 57, in main
manager.sync(
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/octodns/manager.py", line 694, in sync
ps, d = future.result()
^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/octodns/manager.py", line 457, in _populate_and_plan
plan = target.plan(zone, processors=processors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/octodns/provider/base.py", line 226, in plan
exists = self.populate(existing, target=True, lenient=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/dns/dns/src/octodns-cloudflare/octodns_cloudflare/__init__.py", line 336, in populate
records = self.zone_records(zone)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/dns/dns/src/octodns-cloudflare/octodns_cloudflare/__init__.py", line 280, in zone_records
zone_id = self.zones.get(zone.name, False)
^^^^^^^^^^
File "/home/runner/work/dns/dns/src/octodns-cloudflare/octodns_cloudflare/__init__.py", line 130, in zones
resp = self._try_request('GET', '/zones',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/dns/dns/src/octodns-cloudflare/octodns_cloudflare/__init__.py", line 91, in _try_request
return self._request(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/dns/dns/src/octodns-cloudflare/octodns_cloudflare/__init__.py", line 110, in _request
raise CloudflareError(resp.json())
octodns_cloudflare.CloudflareError: Invalid request headers
Provider is defined as:
cloudflare:
class: octodns_cloudflare.CloudflareProvider
token: env/CLOUDFLARE_TOKEN
pagerules: false
Email is not defined in env vars:
- name: Plan sync with DNS providers
if: github.event_name == 'pull_request'
run: octodns-sync --config-file=./config/production.yaml
env:
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
Facing a similar issue as of OctoDNS version
1.0.0
. Version0.9.2
is working fine:
Shouldn't be any differences in octodns core that impact the HTTP requests of octodns-cloudflare. Did the versions of anything else change as well?
What version of octodns-cloudflare are you running? The line numbers in your stacktrace above don't align with 0.0.1, 0.0.2, or what's currently in HEAD.
My bad, I had indeed pinned the version to:
-e git+https://git@github.com/octodns/octodns-cloudflare.git@0a6d3e82ab1904aca549196a5a477f8bd74482c7#egg=octodns_cloudflare
# octodns_cloudflare==0.0.1 - Awaiting support for disabling page rules
Bumping to following solved the issue:
octodns_cloudflare==0.0.2
Thanks for the quick support and apologies for wasting your time on such issue.
@quistian Do you still have that issue? It seems that there might be a confusion/documentation issue with the key type that is usable. See for example:
Could you double-check if you are using the correct type of key?
I am still having issues!
2023-10-29T18:23:59 [8179962624] INFO Manager __init__: config_file=config.yaml, (octoDNS 1.2.1)
2023-10-29T18:23:59 [8179962624] INFO Manager _config_executor: max_workers=1
2023-10-29T18:23:59 [8179962624] INFO Manager _config_include_meta: include_meta=False
2023-10-29T18:23:59 [8179962624] INFO Manager _config_auto_arpa: auto_arpa=False
2023-10-29T18:23:59 [8179962624] INFO Manager __init__: global_processors=[]
2023-10-29T18:23:59 [8179962624] INFO Manager __init__: global_post_processors=[]
2023-10-29T18:23:59 [8179962624] INFO Manager __init__: provider=zones (octodns.provider.yaml 1.2.1)
2023-10-29T18:23:59 [8179962624] ERROR Manager _get_{}_class: Unable to import module octodns_cloudflare.CloudflareProvider
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/octodns/manager.py", line 330, in _get_named_class
module, version = self._import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/octodns/manager.py", line 316, in _import_module
module = import_module(current)
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'octodns_cloudflare'
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/octodns/manager.py", line 330, in _get_named_class
module, version = self._import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/octodns/manager.py", line 316, in _import_module
module = import_module(current)
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'octodns_cloudflare'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/bin/octodns-dump", line 8, in <module>
sys.exit(main())
^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/octodns/cmds/dump.py", line 50, in main
manager = Manager(args.config_file)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/octodns/manager.py", line 123, in __init__
self.providers = self._config_providers(providers_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/octodns/manager.py", line 215, in _config_providers
_class, module, version = self._get_named_class(
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/octodns/manager.py", line 335, in _get_named_class
raise ManagerException(
octodns.manager.ManagerException: Unknown provider class: octodns_cloudflare.CloudflareProvider, config.yaml, line 9, column 5
@jdogcoder it seems that the last two comments were related to #66 ? @quistian I will close this one as outdated. Feel free to re-open, if you still encounter issues.
In test / sync mode I get the following error using my CloudFlare account as a source:
resp = self._try_request( File "/home/russ/src/dns/venv-octodns/lib/python3.10/site-packages/octodns_cloudflare/init.py", line 113, in _try_request return self._request(*args, **kwargs) File "/home/russ/src/dns/venv-octodns/lib/python3.10/site-packages/octodns_cloudflare/init.py", line 136, in _request raise CloudflareError(resp.json()) octodns_cloudflare.CloudflareError: Invalid request headers
I've set the following environment variables:
export CLOUDFLARE_TOKEN="l***U" export CLOUDFLARE_EMAIL="russ@quist.ca"