Skip to content

Commit 6ecffb3

Browse files
committed
vmss deallocate migration
1 parent c67314c commit 6ecffb3

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

  • src/azure-cli/azure/cli/command_modules/vm/operations

src/azure-cli/azure/cli/command_modules/vm/operations/vmss.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
# --------------------------------------------------------------------------------------------
55
# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument
66
from knack.log import get_logger
7-
7+
from azure.cli.core.aaz import register_command
88
from ..aaz.latest.vmss import ListInstances as _VMSSListInstances
9+
from ..aaz.latest.vmss import Deallocate as _VMSSDeallocate
910

1011
logger = get_logger(__name__)
1112

@@ -25,3 +26,17 @@ def _output(self, *args, **kwargs):
2526
result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True)
2627
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
2728
return result, next_link
29+
30+
class VMSSDeallocate(_VMSSDeallocate):
31+
def _output(self, *args, **kwargs):
32+
from azure.cli.core.aaz import AAZUndefined, has_value
33+
34+
# Resolve flatten conflict
35+
# When the type field conflicts, the type in inner layer is ignored and the outer layer is applied
36+
if has_value(self.ctx.vars.instance.resources):
37+
for resource in self.ctx.vars.instance.resources:
38+
if has_value(resource.type):
39+
resource.type = AAZUndefined
40+
41+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
42+
return result

0 commit comments

Comments
 (0)