Skip to content

Commit e5f53f6

Browse files
authored
[ml] fix drop required rules from workspace update request (Azure#32643)
* move rule modification * fix
1 parent c237dc4 commit e5f53f6

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/operations/_workspace_operations_base.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,14 @@ def begin_update(
258258
if isinstance(managed_network, str):
259259
managed_network = ManagedNetwork(isolation_mode=managed_network)._to_rest_object()
260260
elif isinstance(managed_network, ManagedNetwork):
261-
managed_network = workspace.managed_network._to_rest_object()
261+
if managed_network.outbound_rules is not None:
262+
# drop recommended and required rules from the update request since it would result in bad request
263+
managed_network.outbound_rules = [
264+
rule
265+
for rule in managed_network.outbound_rules
266+
if rule.category not in (OutboundRuleCategory.REQUIRED, OutboundRuleCategory.RECOMMENDED)
267+
]
268+
managed_network = managed_network._to_rest_object()
262269

263270
container_registry = kwargs.get("container_registry", workspace.container_registry)
264271
# Empty string is for erasing the value of container_registry, None is to be ignored value
@@ -331,14 +338,6 @@ def begin_update(
331338
)
332339
)
333340

334-
if workspace.managed_network is not None and workspace.managed_network.outbound_rules is not None:
335-
# drop recommended and required rules from the update request since it would result in bad request
336-
workspace.managed_network.outbound_rules = [
337-
rule
338-
for rule in workspace.managed_network.outbound_rules
339-
if rule.category not in (OutboundRuleCategory.REQUIRED, OutboundRuleCategory.RECOMMENDED)
340-
]
341-
342341
update_role_assignment = (
343342
kwargs.get("update_workspace_role_assignment", None)
344343
or kwargs.get("update_offline_store_role_assignment", None)

0 commit comments

Comments
 (0)