Skip to content

Commit

Permalink
Add comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Aug 26, 2019
1 parent b935712 commit 64196c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ansible/modules/crypto/acme/acme_certificate.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -996,6 +996,9 @@ def finish_challenges(self):
self._validate_challenges(identifier_type, identifier, auth) self._validate_challenges(identifier_type, identifier, auth)


def _chain_matches(self, chain, criterium): def _chain_matches(self, chain, criterium):
'''
Check whether an alternate chain matches the specified criterium.
'''
if criterium['test_certificates'] == 'last': if criterium['test_certificates'] == 'last':
chain = chain[-1:] chain = chain[-1:]
for cert in chain: for cert in chain:
Expand Down Expand Up @@ -1067,6 +1070,7 @@ def get_certificate(self):
cert_uri = self._finalize_cert() cert_uri = self._finalize_cert()
cert = self._download_cert(cert_uri) cert = self._download_cert(cert_uri)
if self.module.params['retrieve_all_alternates'] or self.module.params['select_alternate_chain']: if self.module.params['retrieve_all_alternates'] or self.module.params['select_alternate_chain']:
# Retrieve alternate chains
alternate_chains = [] alternate_chains = []
for alternate in cert['alternates']: for alternate in cert['alternates']:
try: try:
Expand All @@ -1076,6 +1080,7 @@ def get_certificate(self):
continue continue
alternate_chains.append(alt_cert) alternate_chains.append(alt_cert)


# Prepare return value for all alternate chains
if self.module.params['retrieve_all_alternates']: if self.module.params['retrieve_all_alternates']:
self.all_chains = [] self.all_chains = []


Expand All @@ -1090,6 +1095,7 @@ def _append_all_chains(cert_data):
for alt_chain in alternate_chains: for alt_chain in alternate_chains:
_append_all_chains(alt_chain) _append_all_chains(alt_chain)


# Try to select alternate chain depending on criteria
if self.module.params['select_alternate_chain']: if self.module.params['select_alternate_chain']:
matching_chain = None matching_chain = None
for criterium_idx, criterium in enumerate(self.module.params['select_alternate_chain']): for criterium_idx, criterium in enumerate(self.module.params['select_alternate_chain']):
Expand Down

0 comments on commit 64196c9

Please sign in to comment.