acme_* modules: make sure 'meta' is always in directory (#221)

* Make sure 'meta' is always in directory.

* Update plugins/module_utils/acme/acme.py
This commit is contained in:
Felix Fontein
2021-04-28 07:31:06 +02:00
committed by GitHub
parent 201920d161
commit f4334d7307
2 changed files with 5 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
bugfixes:
- "acme_* modules - avoid crashing for ACME servers where the ``meta`` directory key is not present (https://github.com/ansible-collections/community.crypto/issues/220, https://github.com/ansible-collections/community.crypto/pull/221)."

View File

@@ -82,6 +82,9 @@ class ACMEDirectory(object):
for key in ('newNonce', 'newAccount', 'newOrder'):
if key not in self.directory:
raise ModuleFailException("ACME directory does not seem to follow protocol ACME v2")
# Make sure that 'meta' is always available
if 'meta' not in self.directory:
self.directory['meta'] = {}
def __getitem__(self, key):
return self.directory[key]