Skip to content

Commit 4ce33cc

Browse files
committed
Allow ensure_resource_permissions to tolerate missing subnets
1 parent 46fc028 commit 4ce33cc

File tree

1 file changed

+10
-6
lines changed
  • src/azure-cli/azure/cli/command_modules/aro

1 file changed

+10
-6
lines changed

src/azure-cli/azure/cli/command_modules/aro/custom.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from base64 import b64decode
99
import textwrap
1010

11-
from azure.core.exceptions import HttpResponseError
11+
from azure.core.exceptions import HttpResponseError, \
12+
ResourceNotFoundError as CoreResourceNotFoundError
1213
from azure.mgmt.core.tools import resource_id, parse_resource_id
1314
import azure.mgmt.redhatopenshift.models as openshiftcluster
1415

@@ -462,11 +463,14 @@ def get_network_resources_from_subnets(cli_ctx, subnets, fail, oc):
462463
Please retry, if issue persists: raise azure support ticket""")
463464
logger.info("Failed to validate subnet '%s'", sn)
464465

465-
subnet = subnet_show(cli_ctx=cli_ctx)(command_args={
466-
"name": sid['resource_name'],
467-
"vnet_name": sid['name'],
468-
"resource_group": sid['resource_group']
469-
})
466+
try:
467+
subnet = subnet_show(cli_ctx=cli_ctx)(command_args={
468+
"name": sid['resource_name'],
469+
"vnet_name": sid['name'],
470+
"resource_group": sid['resource_group']}
471+
)
472+
except CoreResourceNotFoundError:
473+
continue
470474

471475
if subnet.get("routeTable", None):
472476
subnet_resources.add(subnet["routeTable"]["id"])

0 commit comments

Comments
 (0)