Skip to content
Closed
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 @@ -532,12 +532,13 @@ def _build_storage_profile():
}
}

vm_properties['additionalCapabilities'] = {}
if ultra_ssd_enabled is not None:
vm_properties['additionalCapabilities']['ultraSSDEnabled'] = ultra_ssd_enabled
if cmd.supported_api_version(min_api='2018-06-01'):
vm_properties['additionalCapabilities'] = {}
if ultra_ssd_enabled is not None:
vm_properties['additionalCapabilities']['ultraSSDEnabled'] = ultra_ssd_enabled

if enable_hibernation is not None:
vm_properties['additionalCapabilities']['hibernationEnabled'] = enable_hibernation
if enable_hibernation is not None:
vm_properties['additionalCapabilities']['hibernationEnabled'] = enable_hibernation

if proximity_placement_group:
vm_properties['proximityPlacementGroup'] = {'id': proximity_placement_group}
Expand Down
25 changes: 14 additions & 11 deletions src/azure-cli/azure/cli/command_modules/vm/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ def _parse_image_argument(cmd, namespace):
namespace.os_offer = matched['offer']
namespace.os_sku = matched['sku']
namespace.os_version = matched['version']
if not any([namespace.plan_name, namespace.plan_product, namespace.plan_publisher]):
image_plan = _get_image_plan_info_if_exists(cmd, namespace)
if image_plan:
namespace.plan_name = image_plan.name
namespace.plan_product = image_plan.product
namespace.plan_publisher = image_plan.publisher
return 'urn'
except requests.exceptions.ConnectionError:
pass
Expand Down Expand Up @@ -1234,7 +1240,7 @@ def _validate_vm_vmss_msi(cmd, namespace, from_set_command=False):
# at the same time to reduce the impact of breaking change
if not from_set_command and namespace.identity_scope and getattr(namespace.identity_role, 'is_default', None):
logger.warning(
"Please note that the default value of parameter '--role' will be removed in the future version 2.35.0. "
"Please note that the default value of parameter '--role' will be removed in the future. "
"So specify '--role' and '--scope' at the same time when assigning a role to the managed identity "
"to avoid breaking your automation script when the default value of '--role' is removed."
)
Expand Down Expand Up @@ -1910,21 +1916,18 @@ def _validate_vmss_terminate_notification(cmd, namespace): # pylint: disable=un


def _validate_vmss_create_automatic_repairs(cmd, namespace): # pylint: disable=unused-argument
if namespace.automatic_repairs_grace_period is not None or namespace.automatic_repairs_action is not None:
if namespace.automatic_repairs_grace_period is not None:
if namespace.load_balancer is None or namespace.health_probe is None:
raise ArgumentUsageError("usage error: --load-balancer and --health-probe are required "
"when creating vmss with automatic repairs")
raise CLIError("usage error: --load-balancer and --health-probe are required "
"when creating vmss with automatic repairs")
_validate_vmss_automatic_repairs(cmd, namespace)


def _validate_vmss_update_automatic_repairs(cmd, namespace): # pylint: disable=unused-argument
if namespace.enable_automatic_repairs is False and \
(namespace.automatic_repairs_grace_period is not None or namespace.automatic_repairs_action is not None):
raise ArgumentUsageError("usage error: please enable --enable-automatic-repairs")
if namespace.enable_automatic_repairs is True and namespace.automatic_repairs_grace_period is None\
and namespace.automatic_repairs_action is None:
raise ArgumentUsageError("usage error: please set --automatic-repairs-grace-period or"
" --automatic-repairs-action")
if namespace.enable_automatic_repairs is False and namespace.automatic_repairs_grace_period is not None:
raise CLIError("usage error: please enable --enable-automatic-repairs")
if namespace.enable_automatic_repairs is True and namespace.automatic_repairs_grace_period is None:
raise CLIError("usage error: please set --automatic-repairs-grace-period")
_validate_vmss_automatic_repairs(cmd, namespace)


Expand Down