Skip to content

Commit

Permalink
add connected env validation for debug console
Browse files Browse the repository at this point in the history
  • Loading branch information
fangjian0423 committed Nov 15, 2024
1 parent 932d6f7 commit dd1610b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/containerapp/azext_containerapp/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,15 @@ def _set_debug_defaults(cmd, namespace):
app = ContainerAppPreviewClient.show(cmd, namespace.resource_group_name, namespace.name)
if not app:
raise ResourceNotFoundError("Could not find a container app")

from azure.mgmt.core.tools import parse_resource_id
parsed_env = parse_resource_id(safe_get(app, "properties", "environmentId"))
resource_type = parsed_env.get("resource_type")
if resource_type:
if CONNECTED_ENVIRONMENT_RESOURCE_TYPE.lower() == resource_type.lower():
raise ValidationError(
"The app belongs to ConnectedEnvironment, which is not support debug console. Please use the apps belong to ManagedEnvironment.")

if not namespace.revision:
namespace.revision = app.get("properties", {}).get("latestRevisionName")
if not namespace.revision:
Expand Down

0 comments on commit dd1610b

Please sign in to comment.