mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 00:35:50 +02:00
Fixing tox cover
This commit is contained in:
@@ -42,7 +42,6 @@ class AuthHandler(object):
|
||||
form of :class:`letsencrypt.achallenges.AnnotatedChallenge`
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, dv_auth, cont_auth, acme, account):
|
||||
self.dv_auth = dv_auth
|
||||
self.cont_auth = cont_auth
|
||||
@@ -76,32 +75,19 @@ class AuthHandler(object):
|
||||
|
||||
self._choose_challenges(domains)
|
||||
|
||||
failed_domains = set()
|
||||
|
||||
# While there are still challenges remaining...
|
||||
while self.dv_c or self.cont_c:
|
||||
cont_resp, dv_resp = self._solve_challenges()
|
||||
logger.info("Waiting for verification...")
|
||||
|
||||
# Send all Responses - this modifies dv_c and cont_c
|
||||
response = self._respond(cont_resp, dv_resp, best_effort)
|
||||
|
||||
if response:
|
||||
failed_domains = failed_domains.union(response)
|
||||
|
||||
my_authzr = self.authzr
|
||||
|
||||
returnDomains = set()
|
||||
#Remove failing domains if best_effort is true
|
||||
for domain in domains:
|
||||
if not domain in failed_domains:
|
||||
returnDomains.add(domain)
|
||||
self._respond(cont_resp, dv_resp, best_effort)
|
||||
|
||||
# Just make sure all decisions are complete.
|
||||
self.verify_authzr_complete()
|
||||
# Only return valid authorizations
|
||||
return ([authzr for authzr in my_authzr.values()
|
||||
if authzr.body.status == messages.STATUS_VALID], returnDomains)
|
||||
return [authzr for authzr in self.authzr.values()
|
||||
if authzr.body.status == messages.STATUS_VALID]
|
||||
|
||||
def _choose_challenges(self, domains):
|
||||
"""Retrieve necessary challenges to satisfy server."""
|
||||
@@ -153,13 +139,11 @@ class AuthHandler(object):
|
||||
|
||||
# Check for updated status...
|
||||
try:
|
||||
result = self._poll_challenges(chall_update, best_effort)
|
||||
self._poll_challenges(chall_update, best_effort)
|
||||
finally:
|
||||
# This removes challenges from self.dv_c and self.cont_c
|
||||
self._cleanup_challenges(active_achalls)
|
||||
|
||||
return result
|
||||
|
||||
def _send_responses(self, achalls, resps, chall_update):
|
||||
"""Send responses and make sure errors are handled.
|
||||
|
||||
@@ -191,7 +175,6 @@ class AuthHandler(object):
|
||||
"""Wait for all challenge results to be determined."""
|
||||
dom_to_check = set(chall_update.keys())
|
||||
comp_domains = set()
|
||||
failed_domains = set()
|
||||
rounds = 0
|
||||
|
||||
while dom_to_check and rounds < max_rounds:
|
||||
@@ -209,8 +192,9 @@ class AuthHandler(object):
|
||||
chall_update[domain].remove(achall)
|
||||
# We failed some challenges... damage control
|
||||
else:
|
||||
# Right now... just assume a loss and carry on...
|
||||
if best_effort:
|
||||
failed_domains.add(domain)
|
||||
comp_domains.add(domain)
|
||||
else:
|
||||
all_failed_achalls.update(
|
||||
updated for _, updated in failed_achalls)
|
||||
@@ -219,12 +203,10 @@ class AuthHandler(object):
|
||||
_report_failed_challs(all_failed_achalls)
|
||||
raise errors.FailedChallenges(all_failed_achalls)
|
||||
|
||||
dom_to_check -= comp_domains.union(failed_domains)
|
||||
dom_to_check -= comp_domains
|
||||
comp_domains.clear()
|
||||
rounds += 1
|
||||
|
||||
return failed_domains
|
||||
|
||||
def _handle_check(self, domain, achalls):
|
||||
"""Returns tuple of ('completed', 'failed')."""
|
||||
completed = []
|
||||
|
||||
Reference in New Issue
Block a user