Skip to content

Commit

Permalink
fixup! Fix: Don't check lifespan field to maintain retro-compatibilit…
Browse files Browse the repository at this point in the history
…y with old diagnostic VM.
  • Loading branch information
hoh committed Oct 10, 2023
1 parent 0779ac6 commit 58a139f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions vm_supervisor/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,29 +146,29 @@ async def index(request: web.Request):


async def status_check_fastapi(request: web.Request):
retro_compatibility: bool = request.rel_url.query.get('retro-compatibility', 'false') == 'true'

async with aiohttp.ClientSession() as session:
result = {
"index": await status.check_index(session),
# Retro-compatibility with old diagnostic VM
# "lifespan": await status.check_lifespan(session),
"environ": await status.check_environ(session),
"messages": await status.check_messages(session),
"dns": await status.check_dns(session),
"ipv4": await status.check_ipv4(session),
# "ipv6": await status.check_ipv6(session),
"internet": await status.check_internet(session),
"cache": await status.check_cache(session),
"persistent_storage": await status.check_persistent_storage(session),
"error_handling": await status.check_error_raised(session),
}

if not all(result.values()):
return web.json_response(result, status=503)

# Retro-compatibility with old diagnostic VM
result["lifespan"] = await status.check_lifespan(session)

return web.json_response(result, status=200)
if not retro_compatibility:
# These fields were added in the runtime running Debian 12.
result = result | {
"lifespan": await status.check_lifespan(session),
# IPv6 requires extra work from node operators and is not required yet.
# "ipv6": await status.check_ipv6(session),
}

return web.json_response(result, status=200 if all(result.values()) else 503)


async def status_check_version(request: web.Request):
Expand Down

0 comments on commit 58a139f

Please sign in to comment.