@@ -2487,7 +2487,7 @@ def format_webapp_status_output(result):
24872487 items = _extract_webapp_status_items(result)
24882488 # LastError is a nullable field on the backend SiteRuntimeStatusOnWorker contract,
24892489 # so the error columns (LastError, LastErrorDetails, LastErrorTimestamp) are only
2490- # surfaced when at least one instance reports a LastError.
2490+ # surfaced when at least one instance reports a LastError.
24912491 show_errors = any(item.get('lastError') for item in items)
24922492
24932493 rows = []
@@ -2513,21 +2513,13 @@ def show_webapp_status(cmd, resource_group_name, name, slot=None, instance=None)
25132513 client = web_client_factory(cmd.cli_ctx)
25142514 subscription_id = get_subscription_id(cmd.cli_ctx)
25152515 api_version = client.DEFAULT_API_VERSION
2516- slot_segment = '/slots/{}'.format(slot) if slot else ''
2517- # When an instance is requested, call the dedicated siteStatus/{instanceId} route
2518- # so the backend resolves and validates the instance (returning 404 if missing).
2519- instance_segment = '/{}'.format(instance) if instance else ''
2516+ resource_manager = cmd.cli_ctx.cloud.endpoints.resource_manager
2517+ slot_segment = f'/slots/{slot}' if slot else ''
2518+ instance_segment = f'/{instance}' if instance else ''
25202519 request_url = (
2521- '{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Web/sites/{}{}/siteStatus{}'
2522- '?api-version={}'.format(
2523- cmd.cli_ctx.cloud.endpoints.resource_manager,
2524- subscription_id,
2525- resource_group_name,
2526- name,
2527- slot_segment,
2528- instance_segment,
2529- api_version
2530- )
2520+ f'{resource_manager}/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}'
2521+ f'/providers/Microsoft.Web/sites/{name}{slot_segment}/siteStatus{instance_segment}'
2522+ f'?api-version={api_version}'
25312523 )
25322524
25332525 try:
@@ -2536,8 +2528,8 @@ def show_webapp_status(cmd, resource_group_name, name, slot=None, instance=None)
25362528 if instance and ex.status_code == 404:
25372529 scope = 'webapp and slot' if slot else 'webapp'
25382530 raise ResourceNotFoundError(
2539- "Instance '{}' was not found for this {}. "
2540- "Run 'az webapp list-instances' to see available instance IDs.".format(instance, scope) )
2531+ f "Instance '{instance }' was not found for this {scope }. "
2532+ "Run 'az webapp list-instances' to see available instance IDs.")
25412533 raise
25422534
25432535
0 commit comments