Skip to content

Commit

Permalink
not report error when existing is already vnet integrated (#5387)
Browse files Browse the repository at this point in the history
Co-authored-by: Li Ma <[email protected]>
  • Loading branch information
levimm and Li Ma authored Sep 27, 2022
1 parent 96e3307 commit 163e5be
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1281,10 +1281,11 @@ def _get_enable_apiserver_vnet_integration(self, enable_validation: bool = False
# validation
if enable_validation:
if self.decorator_mode == DecoratorMode.UPDATE:
if enable_apiserver_vnet_integration:
is_apiserver_vnet_integration_cluster = check_is_apiserver_vnet_integration_cluster(self.mc)
if enable_apiserver_vnet_integration and not is_apiserver_vnet_integration_cluster:
if self._get_apiserver_subnet_id(enable_validation=False) is None:
raise RequiredArgumentMissingError(
"--apiserver-subnet-id is required for update with --apiserver-vnet-integration."
"--apiserver-subnet-id is required for update with --enable-apiserver-vnet-integration."
)

return enable_apiserver_vnet_integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2163,6 +2163,24 @@ def test_get_enable_apiserver_vnet_integration(self):
with self.assertRaises(RequiredArgumentMissingError):
ctx_5.get_enable_apiserver_vnet_integration()


ctx_6 = AKSPreviewManagedClusterContext(
self.cmd,
AKSManagedClusterParamDict({
"enable_apiserver_vnet_integration": True,
}),
self.models,
decorator_mode=DecoratorMode.UPDATE,
)
api_server_access_profile = self.models.ManagedClusterAPIServerAccessProfile()
api_server_access_profile.enable_vnet_integration = True
mc = self.models.ManagedCluster(
location="test_location",
api_server_access_profile=api_server_access_profile,
)
ctx_6.attach_mc(mc)
self.assertEqual(ctx_6.get_enable_apiserver_vnet_integration(), True)

def test_get_apiserver_subnet_id(self):
ctx_0 = AKSPreviewManagedClusterContext(
self.cmd,
Expand Down

0 comments on commit 163e5be

Please sign in to comment.