Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ExtendedLocation property on object level #4

Merged
merged 1 commit into from
Aug 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/appservice-kube/azext_appservice_kube/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,16 @@ def _get_kube_env_from_custom_location(cmd, custom_location):

kube_envs = cf_kube_environments(cmd.cli_ctx).list_by_subscription()
for kube in kube_envs:
if kube.extended_location and kube.extended_location.custom_location:
parsed_custom_location_2 = None

if kube.additional_properties and 'extendedLocation' in kube.additional_properties:
parsed_custom_location_2 = parse_resource_id(kube.additional_properties['extendedLocation'].get('name'))
elif kube.extended_location and kube.extended_location.custom_location:
parsed_custom_location_2 = parse_resource_id(kube.extended_location.custom_location)
if parsed_custom_location_2.get("name").lower() == custom_location.lower():
kube_environment_id = kube.id
break

if parsed_custom_location_2 and parsed_custom_location_2.get("name").lower() == custom_location.lower():
kube_environment_id = kube.id
break

if not kube_environment_id:
raise ResourceNotFoundError('Unable to find Kube Environment associated to the Custom Location')
Expand Down