Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compute] az vm create: Fix creating VM with --patch-mode or --enable-auto-update parameters #30568

Merged
merged 3 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ def _build_os_profile():
os_profile['secrets'] = secrets

if enable_auto_update is not None and custom_image_os_type.lower() == 'windows':
if 'windowsConfiguration' not in os_profile:
os_profile['windowsConfiguration'] = {}
os_profile['windowsConfiguration']['enableAutomaticUpdates'] = enable_auto_update

# Windows patch settings
Expand All @@ -368,6 +370,9 @@ def _build_os_profile():
raise ValidationError(
'Invalid value of --patch-mode for Windows VM. Valid values are AutomaticByOS, '
'AutomaticByPlatform, Manual.')

if 'windowsConfiguration' not in os_profile:
os_profile['windowsConfiguration'] = {}
os_profile['windowsConfiguration']['patchSettings'] = {
'patchMode': patch_mode,
'enableHotpatching': enable_hotpatching
Expand All @@ -378,6 +383,9 @@ def _build_os_profile():
if patch_mode.lower() not in ['automaticbyplatform', 'imagedefault']:
raise ValidationError(
'Invalid value of --patch-mode for Linux VM. Valid values are AutomaticByPlatform, ImageDefault.')

if 'linuxConfiguration' not in os_profile:
os_profile['linuxConfiguration'] = {}
os_profile['linuxConfiguration']['patchSettings'] = {
'patchMode': patch_mode
}
Expand Down
Loading