Skip to content

Commit 9322fd2

Browse files
authored
[Compute] az vm auto-shutdown: Fix the issue that --webhook is required when --email is passed in (#18958)
* Fix the issue that --webhook is required when parameter --email is passed in * resolve conflicts
1 parent abc5125 commit 9322fd2

File tree

3 files changed

+233
-124
lines changed

3 files changed

+233
-124
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,15 +1065,16 @@ def auto_shutdown_vm(cmd, resource_group_name, vm_name, off=None, email=None, we
10651065
raise CLIError('usage error: --time is a required parameter')
10661066
daily_recurrence = {'time': time}
10671067
notification_settings = None
1068-
if email and not webhook:
1069-
raise CLIError('usage error: --webhook is a required parameter when --email exists')
1070-
if webhook:
1068+
if email or webhook:
10711069
notification_settings = {
1072-
'emailRecipient': email,
1073-
'webhookUrl': webhook,
10741070
'timeInMinutes': 30,
10751071
'status': 'Enabled'
10761072
}
1073+
if email:
1074+
notification_settings['emailRecipient'] = email
1075+
if webhook:
1076+
notification_settings['webhookUrl'] = webhook
1077+
10771078
schedule = Schedule(status='Enabled',
10781079
target_resource_id=vm_id,
10791080
daily_recurrence=daily_recurrence,

0 commit comments

Comments
 (0)