Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix for #13291- az webapp deployment slot swap should support preserv…
…eVnet
  • Loading branch information
Kotasudhakarreddy committed Jan 5, 2021
commit 06c544bd5b4bde90faf3f9c22c1033cd37fccea4
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ def load_arguments(self, _):
c.argument('auto_swap_slot', help='target slot to auto swap', default='production')
c.argument('disable', help='disable auto swap', action='store_true')
c.argument('target_slot', help="target slot to swap, default to 'production'")
c.argument('preserve_vnet', help="preserve Virtual Network to the slot during swap, default to 'true'",
arg_type=get_three_state_flag(return_label=True))
with self.argument_context('webapp deployment slot create') as c:
c.argument('configuration_source',
help="source slot to clone configurations from. Use web app's name to refer to the production slot")
Expand Down
11 changes: 7 additions & 4 deletions src/azure-cli/azure/cli/command_modules/appservice/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2197,19 +2197,22 @@ def list_slots(cmd, resource_group_name, webapp):
return slots


def swap_slot(cmd, resource_group_name, webapp, slot, target_slot=None, action='swap'):
def swap_slot(cmd, resource_group_name, webapp, slot, target_slot=None, preserve_vnet=None, action='swap'):
client = web_client_factory(cmd.cli_ctx)
isPreserveVnet = preserve_vnet if preserve_vnet is not None else 'true'
# converstion from string to Boolean
isPreserveVnet = bool(isPreserveVnet == 'true')
if action == 'swap':
poller = client.web_apps.swap_slot_slot(resource_group_name, webapp,
slot, (target_slot or 'production'), True)
slot, (target_slot or 'production'), isPreserveVnet)
return poller
if action == 'preview':
if target_slot is None:
result = client.web_apps.apply_slot_config_to_production(resource_group_name,
webapp, slot, True)
webapp, slot, isPreserveVnet)
else:
result = client.web_apps.apply_slot_configuration_slot(resource_group_name, webapp,
slot, target_slot, True)
slot, target_slot, isPreserveVnet)
return result
# we will reset both source slot and target slot
if target_slot is None:
Expand Down
Loading