Skip to content

Commit

Permalink
[Service Fabric] az sf managed-cluster create: Fix tag parsing for cl…
Browse files Browse the repository at this point in the history
…uster command (#22752)
  • Loading branch information
LukeSlev authored Jun 8, 2022
1 parent 59ca6ec commit fb8e585
Show file tree
Hide file tree
Showing 3 changed files with 1,322 additions and 337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from knack.log import get_logger
from knack.util import CLIError
from azure.cli.core.azclierror import ValidationError
from azure.cli.core.commands.validators import validate_tags
from azure.cli.command_modules.servicefabric._sf_utils import _get_resource_group_by_name
from azure.mgmt.servicefabricmanagedclusters.models import (PartitionScheme, ServiceKind)
from ._client_factory import servicefabric_client_factory, servicefabric_managed_client_factory
Expand Down Expand Up @@ -99,6 +100,7 @@ def validate_create_application(cmd, namespace):

# Managed Clusters
def validate_create_managed_cluster(cmd, namespace):
validate_tags(namespace)
rg = _get_resource_group_by_name(cmd.cli_ctx, namespace.resource_group_name)
if rg is None and namespace.location is None:
raise CLIError("Resource group {} doesn't exists and location is not provided. "
Expand All @@ -119,6 +121,7 @@ def validate_create_managed_cluster(cmd, namespace):


def validate_create_managed_service(namespace):
validate_tags(namespace)
if namespace.service_type is None:
raise CLIError("--service-type is required")

Expand Down Expand Up @@ -162,6 +165,7 @@ def validate_create_managed_service(namespace):


def validate_update_managed_service(cmd, namespace):
validate_tags(namespace)
client = servicefabric_managed_client_factory(cmd.cli_ctx)
service = _safe_get_resource(client.services.get,
(namespace.resource_group_name, namespace.cluster_name,
Expand Down Expand Up @@ -264,6 +268,7 @@ def validate_update_managed_service_correlation(cmd, namespace):


def validate_update_managed_application(cmd, namespace):
validate_tags(namespace)
client = servicefabric_managed_client_factory(cmd.cli_ctx)
app = _safe_get_resource(client.applications.get,
(namespace.resource_group_name, namespace.cluster_name, namespace.application_name))
Expand Down Expand Up @@ -299,6 +304,7 @@ def validate_update_managed_application(cmd, namespace):


def validate_create_managed_application(cmd, namespace):
validate_tags(namespace)
client = servicefabric_managed_client_factory(cmd.cli_ctx)
if namespace.package_url is None:
type_version = _safe_get_resource(client.application_type_versions.get,
Expand Down
Loading

0 comments on commit fb8e585

Please sign in to comment.