Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj committed Dec 19, 2024
1 parent 1bba2a0 commit fb2b275
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _perform_internal(self, domain, validation_name, validation_content):
response = requests.post(LECA_DNS_URL, data=json.dumps({
'token': validation_content,
'hostnames': [domain], # We should be using validation name here
}), headers=auth_headers(self.attributes))
}), headers=auth_headers(self.attributes), timeout=30)
if response.status_code != 201:
raise CallError(
f'Failed to perform {self.NAME} challenge for {domain!r} domain with '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ async def poll_once(self, claim_token, system_id):
async def setup(middleware):
tn_config = await middleware.call('tn_connect.config')
if tn_config['status'] == Status.REGISTRATION_FINALIZATION_WAITING.name:
logger.debug(
'Registration finalization failed as middleware was restarted while waiting '
'for TNC registration finalization'
)
# This means middleware got restarted or the system was rebooted while we were waiting for
# registration to finalize, so in this case we set the state to registration failed
await middleware.call('tn_connect.finalize.status_update', Status.REGISTRATION_FINALIZATION_FAILED)
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def _call(
headers = headers or {}
headers['Content-Type'] = 'application/json'
try:
async with aiohttp.timeout(timeout):
async with asyncio.timeout(timeout):
async with aiohttp.ClientSession(raise_for_status=True, trust_env=True) as session:
req = await getattr(session, mode)(
endpoint,
Expand Down

0 comments on commit fb2b275

Please sign in to comment.