From 5d5ed03485e020edb6f33022b4abc797c6edcc1b Mon Sep 17 00:00:00 2001 From: Devesh Guha Oleti Muni <devesh.oleti@microsoft.com> Date: Wed, 22 Feb 2023 18:40:42 -0800 Subject: [PATCH] [DeploymentManager] BREAKING CHANGE: `az deploymentmanager`: Remove command module since it is no longer maintained by service (#25523) --- azure-cli.pyproj | 10 - azure-cli2017.pyproj | 20 - doc/sphinx/azhelpgen/doc_source_map.json | 1 - linter_exclusions.yml | 65 -- scripts/ci/automation_full_test.py | 1 - scripts/live_test/CLITest.yml | 2 - .../azure/cli/core/profiles/_shared.py | 1 - .../deploymentmanager/__init__.py | 32 - .../deploymentmanager/_client_factory.py | 34 - .../deploymentmanager/_help.py | 320 ------- .../deploymentmanager/_params.py | 171 ---- .../deploymentmanager/commands.py | 106 --- .../deploymentmanager/custom.py | 408 --------- .../deploymentmanager/tests/__init__.py | 4 - .../tests/latest/__init__.py | 4 - .../artifactroot/storage.copy.parameters.json | 24 - .../artifactroot/storage.copy.template.json | 43 - .../artifactroot/storage.parameters.json | 24 - .../latest/artifactroot/storage.template.json | 43 - .../storage_invalid.parameters.json | 24 - .../tests/latest/createrollout.json | 34 - .../latest/createrollout_failurerollout.json | 29 - .../tests/latest/healthcheck_step.json | 56 -- .../latest/test_deploymentmanager_scenario.py | 864 ------------------ src/azure-cli/requirements.py3.Darwin.txt | 1 - src/azure-cli/requirements.py3.Linux.txt | 1 - src/azure-cli/requirements.py3.windows.txt | 1 - src/azure-cli/service_name.json | 5 - src/azure-cli/setup.py | 1 - 29 files changed, 2329 deletions(-) delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/__init__.py delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/_client_factory.py delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/_help.py delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/_params.py delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/commands.py delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/custom.py delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/__init__.py delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/__init__.py delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.copy.parameters.json delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.copy.template.json delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.parameters.json delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.template.json delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage_invalid.parameters.json delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/createrollout.json delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/createrollout_failurerollout.json delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/healthcheck_step.json delete mode 100644 src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/test_deploymentmanager_scenario.py diff --git a/azure-cli.pyproj b/azure-cli.pyproj index e59e64b1ccc..687601ef6dd 100644 --- a/azure-cli.pyproj +++ b/azure-cli.pyproj @@ -349,16 +349,6 @@ <Compile Include="command_modules\azure-cli-consumption\azure\cli\command_modules\consumption\__init__.py" /> <Compile Include="command_modules\azure-cli-consumption\azure_bdist_wheel.py" /> <Compile Include="command_modules\azure-cli-consumption\setup.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\azure\cli\command_modules\deploymentmanager\commands.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\azure\cli\command_modules\deploymentmanager\custom.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\azure\cli\command_modules\deploymentmanager\tests\latest\recording_processors.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\azure\cli\command_modules\deploymentmanager\tests\latest\test_deploymentmanager_scenario.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\azure\cli\command_modules\deploymentmanager\_client_factory.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\azure\cli\command_modules\deploymentmanager\_help.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\azure\cli\command_modules\deploymentmanager\_params.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\azure\cli\command_modules\deploymentmanager\__init__.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\azure_bdist_wheel.py" /> - <Compile Include="command_modules\azure-cli-deploymentmanager\setup.py" /> <Compile Include="command_modules\azure-cli-dla\azure\cli\command_modules\dla\commands.py" /> <Compile Include="command_modules\azure-cli-dla\azure\cli\command_modules\dla\custom.py" /> <Compile Include="command_modules\azure-cli-dla\azure\cli\command_modules\dla\tests\latest\recording_processors.py" /> diff --git a/azure-cli2017.pyproj b/azure-cli2017.pyproj index 56fd08d3678..dc1d455ca7d 100644 --- a/azure-cli2017.pyproj +++ b/azure-cli2017.pyproj @@ -446,15 +446,6 @@ <Compile Include="azure-cli\azure\cli\command_modules\cosmosdb\_params.py" /> <Compile Include="azure-cli\azure\cli\command_modules\cosmosdb\_validators.py" /> <Compile Include="azure-cli\azure\cli\command_modules\cosmosdb\__init__.py" /> - <Compile Include="azure-cli\azure\cli\command_modules\deploymentmanager\commands.py" /> - <Compile Include="azure-cli\azure\cli\command_modules\deploymentmanager\custom.py" /> - <Compile Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\test_deploymentmanager_scenario.py" /> - <Compile Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\__init__.py" /> - <Compile Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\__init__.py" /> - <Compile Include="azure-cli\azure\cli\command_modules\deploymentmanager\_client_factory.py" /> - <Compile Include="azure-cli\azure\cli\command_modules\deploymentmanager\_help.py" /> - <Compile Include="azure-cli\azure\cli\command_modules\deploymentmanager\_params.py" /> - <Compile Include="azure-cli\azure\cli\command_modules\deploymentmanager\__init__.py" /> <Compile Include="azure-cli\azure\cli\command_modules\dla\commands.py" /> <Compile Include="azure-cli\azure\cli\command_modules\dla\custom.py" /> <Compile Include="azure-cli\azure\cli\command_modules\dla\tests\latest\recording_processors.py" /> @@ -1071,10 +1062,6 @@ <Folder Include="azure-cli\azure\cli\command_modules\cosmosdb\" /> <Folder Include="azure-cli\azure\cli\command_modules\cosmosdb\tests\" /> <Folder Include="azure-cli\azure\cli\command_modules\cosmosdb\tests\latest\" /> - <Folder Include="azure-cli\azure\cli\command_modules\deploymentmanager\" /> - <Folder Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\" /> - <Folder Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\" /> - <Folder Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\artifactroot\" /> <Folder Include="azure-cli\azure\cli\command_modules\dla\" /> <Folder Include="azure-cli\azure\cli\command_modules\dla\tests\" /> <Folder Include="azure-cli\azure\cli\command_modules\dla\tests\latest\" /> @@ -1343,13 +1330,6 @@ <Content Include="azure-cli\azure\cli\command_modules\botservice\web.config" /> <Content Include="azure-cli\azure\cli\command_modules\botservice\webapp.template.json" /> <Content Include="azure-cli\azure\cli\command_modules\botservice\webappv4.template.json" /> - <Content Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\artifactroot\storage.copy.parameters.json" /> - <Content Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\artifactroot\storage.copy.template.json" /> - <Content Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\artifactroot\storage.parameters.json" /> - <Content Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\artifactroot\storage.template.json" /> - <Content Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\artifactroot\storage_invalid.parameters.json" /> - <Content Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\createrollout.json" /> - <Content Include="azure-cli\azure\cli\command_modules\deploymentmanager\tests\latest\createrollout_failurerollout.json" /> <Content Include="azure-cli\azure\cli\command_modules\keyvault\tests\latest\ec256.pem" /> <Content Include="azure-cli\azure\cli\command_modules\keyvault\tests\latest\ec521pw.pem" /> <Content Include="azure-cli\azure\cli\command_modules\keyvault\tests\latest\import_pem_encrypted_pwd_123.pem" /> diff --git a/doc/sphinx/azhelpgen/doc_source_map.json b/doc/sphinx/azhelpgen/doc_source_map.json index 598686242cf..a4378cc7cfb 100644 --- a/doc/sphinx/azhelpgen/doc_source_map.json +++ b/doc/sphinx/azhelpgen/doc_source_map.json @@ -26,7 +26,6 @@ "cosmosdb": "src/azure-cli/azure/cli/command_modules/cosmosdb/_help.py", "databoxedge": "src/azure-cli/azure/cli/command_modules/databoxedge/_help.py", "deployment": "src/azure-cli/azure/cli/command_modules/resource/_help.py", - "deploymentmanager": "src/azure-cli/azure/cli/command_modules/deploymentmanager/_help.py", "dla": "src/azure-cli/azure/cli/command_modules/dla/_help.py", "dls": "src/azure-cli/azure/cli/command_modules/dls/_help.py", "dms": "src/azure-cli/azure/cli/command_modules/dms/_help.py", diff --git a/linter_exclusions.yml b/linter_exclusions.yml index 9da034c25ba..418a877b67f 100644 --- a/linter_exclusions.yml +++ b/linter_exclusions.yml @@ -1484,71 +1484,6 @@ cosmosdb collection: db_resource_group_name: rule_exclusions: - parameter_should_not_end_in_resource_group -deploymentmanager service create: - parameters: - service_topology_name: - rule_exclusions: - - option_length_too_long - target_subscription_id: - rule_exclusions: - - option_length_too_long -deploymentmanager service delete: - parameters: - service_topology_name: - rule_exclusions: - - option_length_too_long -deploymentmanager service list: - parameters: - service_topology_name: - rule_exclusions: - - option_length_too_long -deploymentmanager service show: - parameters: - service_topology_name: - rule_exclusions: - - option_length_too_long -deploymentmanager service update: - parameters: - service_topology_name: - rule_exclusions: - - option_length_too_long - target_subscription_id: - rule_exclusions: - - option_length_too_long -deploymentmanager service-unit create: - parameters: - service_topology_name: - rule_exclusions: - - option_length_too_long - target_resource_group: - rule_exclusions: - - option_length_too_long -deploymentmanager service-unit delete: - parameters: - service_topology_name: - rule_exclusions: - - option_length_too_long -deploymentmanager service-unit list: - parameters: - service_topology_name: - rule_exclusions: - - option_length_too_long -deploymentmanager service-unit show: - parameters: - service_topology_name: - rule_exclusions: - - option_length_too_long -deploymentmanager service-unit update: - parameters: - deployment_mode: - rule_exclusions: - - no_parameter_defaults_for_update_commands - service_topology_name: - rule_exclusions: - - option_length_too_long - target_resource_group: - rule_exclusions: - - option_length_too_long disk create: parameters: gallery_image_reference: diff --git a/scripts/ci/automation_full_test.py b/scripts/ci/automation_full_test.py index 599ab3c62d7..be3d967d8aa 100644 --- a/scripts/ci/automation_full_test.py +++ b/scripts/ci/automation_full_test.py @@ -56,7 +56,6 @@ 'container': 19, 'cosmosdb': 45, 'databoxedge': 25, - 'deploymentmanager': 18, 'dla': 19, 'dls': 22, 'dms': 22, diff --git a/scripts/live_test/CLITest.yml b/scripts/live_test/CLITest.yml index 53c275e7342..ff8815a9fe2 100644 --- a/scripts/live_test/CLITest.yml +++ b/scripts/live_test/CLITest.yml @@ -73,8 +73,6 @@ jobs: Target: cosmosdb databoxedge: Target: databoxedge - deploymentmanager: - Target: deploymentmanager dla: Target: dla dls: diff --git a/src/azure-cli-core/azure/cli/core/profiles/_shared.py b/src/azure-cli-core/azure/cli/core/profiles/_shared.py index 25e713ea6e2..5dc20c995e5 100644 --- a/src/azure-cli-core/azure/cli/core/profiles/_shared.py +++ b/src/azure-cli-core/azure/cli/core/profiles/_shared.py @@ -96,7 +96,6 @@ class ResourceType(Enum): # pylint: disable=too-few-public-methods MGMT_CONSUMPTION = ('azure.mgmt.consumption', None) MGMT_CONTAINERINSTANCE = ('azure.mgmt.containerinstance', None) MGMT_COSMOSDB = ('azure.mgmt.cosmosdb', None) - MGMT_DEPLOYMENTMANAGER = ('azure.mgmt.deploymentmanager', None) MGMT_DATALAKE_ANALYTICS = ('azure.mgmt.datalake.analytics', None) MGMT_DATALAKE_STORE = ('azure.mgmt.datalake.store', None) MGMT_DATAMIGRATION = ('azure.mgmt.datamigration', None) diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/__init__.py b/src/azure-cli/azure/cli/command_modules/deploymentmanager/__init__.py deleted file mode 100644 index 248e73d4672..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from azure.cli.core import AzCommandsLoader - -import azure.cli.command_modules.deploymentmanager._help # pylint: disable=unused-import - - -class DeploymentManagerCommandsLoader(AzCommandsLoader): - - def __init__(self, cli_ctx=None): - from azure.cli.core.commands import CliCommandType - from azure.cli.core.profiles import ResourceType - deploymentmanager_custom = CliCommandType( - operations_tmpl='azure.cli.command_modules.deploymentmanager.custom#{}') - super(DeploymentManagerCommandsLoader, self).__init__(cli_ctx=cli_ctx, - resource_type=ResourceType.MGMT_DEPLOYMENTMANAGER, - custom_command_type=deploymentmanager_custom) - - def load_command_table(self, args): - from azure.cli.command_modules.deploymentmanager.commands import load_command_table - load_command_table(self, args) - return self.command_table - - def load_arguments(self, command): - from azure.cli.command_modules.deploymentmanager._params import load_arguments - load_arguments(self, command) - - -COMMAND_LOADER_CLS = DeploymentManagerCommandsLoader diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/_client_factory.py b/src/azure-cli/azure/cli/command_modules/deploymentmanager/_client_factory.py deleted file mode 100644 index 2fc1590d7a6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/_client_factory.py +++ /dev/null @@ -1,34 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -def _deploymentmanager_client_factory(cli_ctx, *_): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.mgmt.deploymentmanager import DeploymentManagerClient - return get_mgmt_service_client(cli_ctx, DeploymentManagerClient) - - -def cf_artifact_sources(cli_ctx, *_): - return _deploymentmanager_client_factory(cli_ctx).artifact_sources - - -def cf_service_topologies(cli_ctx, *_): - return _deploymentmanager_client_factory(cli_ctx).service_topologies - - -def cf_services(cli_ctx, *_): - return _deploymentmanager_client_factory(cli_ctx).services - - -def cf_service_units(cli_ctx, *_): - return _deploymentmanager_client_factory(cli_ctx).service_units - - -def cf_steps(cli_ctx, *_): - return _deploymentmanager_client_factory(cli_ctx).steps - - -def cf_rollouts(cli_ctx, *_): - return _deploymentmanager_client_factory(cli_ctx).rollouts diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/_help.py b/src/azure-cli/azure/cli/command_modules/deploymentmanager/_help.py deleted file mode 100644 index 5887e518b31..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/_help.py +++ /dev/null @@ -1,320 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from knack.help_files import helps # pylint: disable=unused-import -# pylint: disable=line-too-long, too-many-lines - -helps['deploymentmanager'] = """ -type: group -short-summary: Create and manage rollouts for your service. -long-summary: To deploy your service across many regions and make sure it is running as expected in each region, you can use deployment manager to coordinate a staged rollout of the service. For more details, visit https://docs.microsoft.com/azure/azure-resource-manager/deployment-manager-overview -""" - -helps['deploymentmanager artifact-source'] = """ -type: group -short-summary: Manage artifact sources. -long-summary: Artifact sources can be used for creating service topologies and rollouts. -""" - -helps['deploymentmanager artifact-source create'] = """ -type: command -short-summary: Creates an artifact source. -examples: - - name: Create a new artifact source. - text: az deploymentmanager artifact-source create -g rg1 -n contosoServiceArtifactSource -l location --sas-uri https://myStorageAct.blob.azure.com/artifacts?st=2019-04-10T22%3A12Z&se=2019-04-11T09%3A12Z&sp=rl&sv=2018-03-28&sr=c&sig=f6Nx8en4sIJQryYFVVj%2B5BdU7bho96jAgOzLO40Twkg%3D -""" - -helps['deploymentmanager artifact-source delete'] = """ -type: command -short-summary: Deletes an artifact source. -examples: - - name: Deletes an artifact source - text: > - az deploymentmanager artifact-source delete -g rg1 -n contosoServiceArtifactSource -""" - -helps['deploymentmanager artifact-source show'] = """ -type: command -short-summary: Get the details of an artifact source. -examples: - - name: Get an artifact source - text: > - az deploymentmanager artifact-source show -g rg1 -n contosoServiceArtifactSource -""" - -helps['deploymentmanager artifact-source list'] = """ -type: command -short-summary: List all artifact sources in a resource group. -examples: - - name: List artifact sources in the given resource group. - text: > - az deploymentmanager artifact-source list -g rg1 -""" - -helps['deploymentmanager artifact-source update'] = """ -type: command -short-summary: Updates an artifact source. -examples: - - name: Updates an artifact source - text: > - az deploymentmanager artifact-source update -g rg1 -n contosoServiceArtifactSource --sas-uri https://dummy.blob.azure.com/updated_sample_sas_uri -""" - -helps['deploymentmanager rollout'] = """ -type: group -short-summary: Manage the rollouts. -long-summary: View progress, restart a failed rollout, stop a running rollout. Rollouts can be created using the 'az group deployment' command. -""" - -helps['deploymentmanager rollout restart'] = """ -type: command -short-summary: Restarts the rollout. -examples: - - name: Restart the rollout - text: > - az deploymentmanager rollout restart -g rg1 -n contosoServiceRollout - - - name: Restart the rollout and skip all steps that have succeeded in the previous run - text: > - az deploymentmanager rollout restart -g rg1 -n contosoServiceRollout --skip-succeeded -""" - -helps['deploymentmanager rollout show'] = """ -type: command -short-summary: Gets the rollout. -examples: - - name: Gets the rollout - text: > - az deploymentmanager rollout show -g rg1 -n contosoServiceRollout - - name: Gets the specific retry attempt of a rollout. Shows the steps run during that attempt. - text: > - az deploymentmanager rollout show -g rg1 -n contosoServiceRollout --retry-attempt 1 -""" - -helps['deploymentmanager rollout list'] = """ -type: command -short-summary: List all rollouts in a resource group -examples: - - name: List all rollouts in the resource group - text: > - az deploymentmanager rollout list -g rg1 -""" - -helps['deploymentmanager rollout stop'] = """ -type: command -short-summary: Stop the rollout. -examples: - - name: Stops the rollout - text: > - az deploymentmanager rollout stop -g rg1 -n contosoServiceRollout -""" - -helps['deploymentmanager service'] = """ -type: group -short-summary: Manage the services in a service topology. -""" - -helps['deploymentmanager service create'] = """ -type: command -short-summary: Creates a service under the specified service topology. -examples: - - name: Create a new service under a service topology. Specify the service by its name, service topology it is in and the resource group name. - text: > - az deploymentmanager service create -g rg1 -l serviceLocation --service-topology-name contosoServiceTopology -n contosoService1 --target-location "East US" --target-subscription-id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -""" - -helps['deploymentmanager service delete'] = """ -type: command -short-summary: Deletes the service topology. -examples: - - name: Deletes a service topology. - text: > - az deploymentmanager service delete -g rg1 --service-topology-name contosoServiceTopology -n contosoService1 -""" - -helps['deploymentmanager service show'] = """ -type: command -short-summary: Get the details of a service. -examples: - - name: Get the service under a service topology. - text: > - az deploymentmanager service show -g rg1 --service-topology-name contosoServiceTopology -n contosoService1 -""" - -helps['deploymentmanager service list'] = """ -type: command -short-summary: List all services in a service topology. -examples: - - name: List all the services under the given service topology. - text: > - az deploymentmanager service list -g rg1 --service-topology-name contosoServiceTopology -""" - -helps['deploymentmanager service update'] = """ -type: command -short-summary: Updates the service. -examples: - - name: Updates the service. - text: > - az deploymentmanager service update -g rg1 --service-topology-name contosoServiceTopology -n contosoService1 --target-location "West US" --target-subscription-id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -""" - -helps['deploymentmanager service-topology'] = """ -type: group -short-summary: Manage service topologies. -""" - -helps['deploymentmanager service-topology create'] = """ -type: command -short-summary: Creates a service topology. -examples: - - name: Create a new service topology. - text: > - az deploymentmanager service-topology create -g rg1 -l topologyLocation -n contosoServiceTopology --artifact-source /subscriptions/mySub/resourcegroups/rg1/providers/Microsoft.DeploymentManager/artifactSources/contosoWebAppArtifactSource -""" - -helps['deploymentmanager service-topology delete'] = """ -type: command -short-summary: Deletes the service topology. -examples: - - name: Deletes a service topology. - text: > - az deploymentmanager service-topology delete -g rg1 -n contosoServiceTopology -""" - -helps['deploymentmanager service-topology show'] = """ -type: command -short-summary: Get the details of a service topology. -examples: - - name: Get the service topology. - text: > - az deploymentmanager service-topology show -g rg1 -n contosoServiceTopology -""" - -helps['deploymentmanager service-topology list'] = """ -type: command -short-summary: List all service topologies in a resource group. -examples: - - name: List all the service topologies in the resource group. - text: > - az deploymentmanager service-topology list -g rg1 -""" - -helps['deploymentmanager service-topology update'] = """ -type: command -short-summary: Updates the service topology. -examples: - - name: Updates the service topology. - text: > - az deploymentmanager service-topology update -g rg1 -n contosoServiceTopology --artifact-source /subscriptions/mySub/resourcegroups/rg1/providers/Microsoft.DeploymentManager/artifactSources/contosoWebAppArtifactSource -""" - -helps['deploymentmanager service-unit'] = """ -type: group -short-summary: Manage the service units. -long-summary: Service units combine to form a service in a service topology. -""" - -helps['deploymentmanager service-unit create'] = """ -type: command -short-summary: Creates a service unit under the specified service and service topology. -examples: - - name: Create a new service unit using relative paths into the artifact source. - description: Specify the service unit by its name, the service and service topology it is in. The template and parameters files are defined as relative paths into the artifact source location referenced in the specified service topology. The resources defined in this template are to be deployed into the target resource group service1ResourceGroup with the deployment mode set to 'Incremental'. - text: > - az deploymentmanager service-unit create -g rg1 -l location --service-topology-name contosoServiceTopology --service-name contosoService1 -n ContosoService1Storage --target-resource-group service1ResourceGroup --deployment-mode Incremental --template-path "Templates/Service1.Storage.json" --parameters-path "Parameters/Service1.Storage.Parameters.json" - - name: Create a new service unit using SAS Uri for template and parameters. - description: Specify the service unit by its name, the service and service topology it is in. The template and parameters files are defined as SAS Uri's. The resources defined in this template are to be deployed into the target resource group service1ResourceGroup with the deployment mode set to 'Incremental'. - text: > - az deploymentmanager service-unit create -g rg1 -l location --service-topology-name contosoServiceTopology --service-name contosoService1 -n ContosoService1Storage \\ - --target-resource-group service1ResourceGroup --deployment-mode Incremental \\ - --template-path "https://ContosoStorage.blob.core.windows.net/ContosoArtifacts/Templates/Service2.Storage.json?sasParameters" \\ - --parameters-path "https://ContosoStorage.blob.core.windows.net/ContosoArtifacts/Parameters/Service2Storage.Parameters.json?sasParameters" -""" - -helps['deploymentmanager service-unit delete'] = """ -type: command -short-summary: Deletes the service unit. -examples: - - name: Deletes a service unit. - text: > - az deploymentmanager service-unit delete -g rg1 --service-topology-name contosoServiceTopology --service-name contosoService1 -n ContosoService1Storage -""" - -helps['deploymentmanager service-unit show'] = """ -type: command -short-summary: Get the details of a service unit. -examples: - - name: Get the service unit. - text: > - az deploymentmanager service-unit show -g rg1 --service-topology-name contosoServiceTopology --service-name contosoService1 -n ContosoService1Storage -""" - -helps['deploymentmanager service-unit list'] = """ -type: command -short-summary: List all service units in a service. -examples: - - name: List the service units in the given service topology and service. - text: > - az deploymentmanager service-unit list -g rg1 --service-topology-name contosoServiceTopology --service-name contosoService1 -""" - -helps['deploymentmanager service-unit update'] = """ -type: command -short-summary: Updates the service unit. -examples: - - name: Updates the service unit. - text: > - az deploymentmanager service-unit update -g rg1 --service-topology-name contosoServiceTopology --service-name contosoService1 -n ContosoService1Storage --target-resource-group service1ResourceGroupUpdated - - name: Updates the service unit. (autogenerated) - text: az deploymentmanager service-unit update --deployment-mode Incremental --resource-group rg1 --service-name contosoService1 --service-topology-name contosoServiceTopology --service-unit-name ContosoService1Storage - crafted: true -""" - -helps['deploymentmanager step'] = """ -type: group -short-summary: Manage the steps. -long-summary: Allows you to manage the steps that can be used in rollouts. -""" - -helps['deploymentmanager step create'] = """ -type: command -short-summary: Creates the step. -examples: - - name: Creates a wait step. - text: > - az deploymentmanager step create -g rg1 -l location -n contosoServiceWaitStep --duration PT30M - - name: Creates a health check step from a JSON file. The step information is read from the file. - text: > - az deploymentmanager step create -g rg1 --step healthcheck_step.json -""" - -helps['deploymentmanager step show'] = """ -type: command -short-summary: Get the details of the step. -examples: - - name: Get the step. - text: > - az deploymentmanager step show -g rg1 -n contosoServiceWaitStep -""" - -helps['deploymentmanager step list'] = """ -type: command -short-summary: List all steps in a resource group. -examples: - - name: List available steps in the given resource group. - text: > - az deploymentmanager step list -g rg1 -""" - -helps['deploymentmanager step update'] = """ -type: command -short-summary: Updates the step. -examples: - - name: Updates a step. - text: > - az deploymentmanager step update -g rg1 -n contosoServiceWaitStep --duration PT20M -""" diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/_params.py b/src/azure-cli/azure/cli/command_modules/deploymentmanager/_params.py deleted file mode 100644 index 1cdd1421408..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/_params.py +++ /dev/null @@ -1,171 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=line-too-long - -from knack.arguments import CLIArgumentType - - -# pylint: disable=too-many-statements -def load_arguments(self, _): - from azure.cli.core.commands.parameters import ( - resource_group_name_type, - get_resource_name_completion_list, - get_location_type, - get_enum_type, - tags_type) - - from azure.mgmt.deploymentmanager.models import ( - DeploymentMode) - - service_topology_name_type = CLIArgumentType(options_list='--service-topology-name', metavar='NAME', completer=get_resource_name_completion_list('Microsoft.DeploymentManager/servicetopologies')) - service_name_type = CLIArgumentType(options_list='--service-name', metavar='NAME') - artifact_source_type = CLIArgumentType(options_list='--artifact-source', metavar='NAME') - - with self.argument_context('deploymentmanager artifact-source') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('location', get_location_type(self.cli_ctx)) - c.argument('artifact_source_name', options_list=['--artifact-source-name', '--name', '-n'], help='The name of the artifact source') - c.argument('sas_uri', options_list=['--sas-uri'], help='The SAS Uri to the Azure Storage container where the artifacts are stored.') - c.argument('artifact_root', options_list=['--artifact-root'], help='The root folder under which the artifacts are to be found. This is the path relative to the Azure storage container provided in --sas-uri.') - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager artifact-source create') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('location', get_location_type(self.cli_ctx), required=True) - c.argument('artifact_source_name', options_list=['--artifact-source-name', '--name', '-n'], help='The name of the artifact source') - c.argument('sas_uri', options_list=['--sas-uri'], help='The SAS Uri to the Azure Storage container where the artifacts are stored.') - c.argument('artifact_root', options_list=['--artifact-root'], help='The root folder under which the artifacts are to be found. This is the path relative to the Azure storage container provided in --sas-uri.') - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager artifact-source update') as c: - c.argument('sas_uri', options_list=['--sas-uri'], help='The SAS Uri to the Azure Storage container where the artifacts are stored.') - c.argument('artifact_root', options_list=['--artifact-root'], help='The root folder under which the artifacts are to be found. This is the path relative to the Azure storage container provided in --sas-uri.') - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager service-topology') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('location', get_location_type(self.cli_ctx), required=True) - c.argument('service_topology_name', options_list=['--service-topology-name', '--name', '-n'], help='The name of the service topology') - c.argument('artifact_source', artifact_source_type, help='The name or resource identifier of the artifact source.') - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager service-topology create') as c: - c.argument('artifact_source', artifact_source_type, help='The name or resource identifier of the artifact source.', required=False) - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager service-topology update') as c: - c.argument('artifact_source', artifact_source_type, help='The name or resource identifier of the artifact source.', required=False) - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager service') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('location', get_location_type(self.cli_ctx), required=True) - c.argument('service_topology_name', service_topology_name_type, help='The name of the service topology') - c.argument('service_name', options_list=['--service-name', '--name', '-n'], help='The name of the service') - c.argument('target_location', options_list='--target-location', help='The location where the resources in the service should be deployed to.') - c.argument('target_subscription_id', options_list='--target-subscription-id', help='The Id of subscription to which the resources in the service should be deployed to.') - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager service create') as c: - c.argument('service_topology_name', service_topology_name_type, help='The name of the service topology') - c.argument('service_name', options_list=['--service-name', '--name', '-n'], help='The name of the service') - c.argument('target_location', options_list='--target-location', help='The location where the resources in the service should be deployed to.') - c.argument('target_subscription_id', options_list='--target-subscription-id', help='The subscription to which the resources in the service should be deployed to.') - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager service update') as c: - c.argument('target_location', options_list='--target-location', help='The location where the resources in the service should be deployed to.') - c.argument('target_subscription_id', options_list='--target-subscription-id', help='The subscription to which the resources in the service should be deployed to.') - c.argument('tags', tags_type) - - target_resource_type = CLIArgumentType(options_list='--target-resource-group', help='The resource group where the resources in the service unit should be deployed to') - deployment_mode_type = CLIArgumentType(options_list='--deployment-mode', arg_type=get_enum_type(DeploymentMode), default=DeploymentMode.incremental, help='The type of depoyment mode to be used when deploying the service unit. Possible values: Incremental, Complete') - template_path_type = CLIArgumentType(options_list='--template-path', help='The path to the ARM template file. Either the full SAS Uri or the relative path in the artifact source for this topology.') - parameters_path_type = CLIArgumentType(options_list='--parameters-path', help='The path to the ARM parameters file. Either the full SAS Uri or the relative path in the artifact source for this topology.') - - with self.argument_context('deploymentmanager service-unit') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('location', get_location_type(self.cli_ctx)) - c.argument('service_topology_name', service_topology_name_type, help='The name of the service topology') - c.argument('service_name', service_name_type, help='The name of the service') - c.argument('service_unit_name', options_list=['--service-unit-name', '--name', '-n'], help='The name of the service unit') - c.argument('target_resource_group', target_resource_type) - c.argument('deployment_mode', deployment_mode_type) - c.argument('template_path', template_path_type) - c.argument('parameters_path', parameters_path_type) - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager service-unit create', arg_group='Named') as c: - c.argument('service_topology_name', service_topology_name_type, help='The name of the service topology') - c.argument('service_name', service_name_type, help='The name of the service') - c.argument('service_unit_name', options_list=['--service-unit-name', '--name', '-n'], help='The name of the service unit') - c.argument('target_resource_group', target_resource_type) - c.argument('deployment_mode', deployment_mode_type) - c.argument('template_uri', template_path_type) - c.argument('parameters_uri', parameters_path_type) - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager service-unit update') as c: - c.argument('service_topology_name', service_topology_name_type, help='The name of the service topology') - c.argument('service_name', service_name_type, help='The name of the service') - c.argument('service_unit_name', options_list=['--service-unit-name', '--name', '-n'], help='The name of the service unit') - c.argument('target_resource_group', target_resource_type) - c.argument('deployment_mode', deployment_mode_type) - c.argument('template_uri', template_path_type) - c.argument('parameters_uri', parameters_path_type) - c.argument('tags', tags_type) - - duration_type = CLIArgumentType(options_list='--duration', help='The duration of the wait step in ISO 8601 format.') - step_name_type = CLIArgumentType(options_list=['--step-name', '--name', '-n'], help='The name of the step', completer=get_resource_name_completion_list('Microsoft.DeploymentManager/steps')) - step_type = CLIArgumentType(options_list='--step', help='The step object, specify either the path to a json file or provide a json string that forms the step resource. The json is expected to be of the same format as the output of the relevant `az deploymentmanager step show` command') - - with self.argument_context('deploymentmanager step') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('location', get_location_type(self.cli_ctx)) - c.argument('step_name', step_name_type) - c.argument('duration', duration_type) - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager step create') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('location', get_location_type(self.cli_ctx)) - c.argument('step_name', step_name_type) - c.argument('step', step_type) - c.argument('duration', duration_type) - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager step update') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('step_name', step_name_type) - c.argument('step', step_type) - c.argument('duration', duration_type) - c.argument('tags', tags_type) - - with self.argument_context('deploymentmanager step show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('step_name', step_name_type) - - with self.argument_context('deploymentmanager step delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('step_name', step_name_type) - - rollout_name_type = CLIArgumentType(options_list=['--rollout-name', '--name', '-n'], help='The name of the rollout', completer=get_resource_name_completion_list('Microsoft.DeploymentManager/rollouts')) - - with self.argument_context('deploymentmanager rollout show') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('rollout_name', rollout_name_type) - - with self.argument_context('deploymentmanager rollout delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('rollout_name', rollout_name_type) - - with self.argument_context('deploymentmanager rollout stop') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('rollout_name', rollout_name_type) - - with self.argument_context('deploymentmanager rollout restart') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('rollout_name', rollout_name_type) - c.argument('skip_succeeded', options_list="--skip-succeeded", help="Skips all the steps that have succeeded in the previous retries of this rollout.") diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/commands.py b/src/azure-cli/azure/cli/command_modules/deploymentmanager/commands.py deleted file mode 100644 index 8d4da455fc5..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/commands.py +++ /dev/null @@ -1,106 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from azure.cli.core.commands import CliCommandType - -# pylint: disable=line-too-long -from azure.cli.command_modules.deploymentmanager._client_factory import (cf_artifact_sources, cf_service_topologies, cf_services, cf_service_units, cf_steps, cf_rollouts) - - -def load_command_table(self, _): - service_topologies = CliCommandType( - operations_tmpl='azure.mgmt.deploymentmanager.operations#ServiceTopologiesOperations.{}', - client_factory=cf_service_topologies) - - services = CliCommandType( - operations_tmpl='azure.mgmt.deploymentmanager.operations#ServicesOperations.{}', - client_factory=cf_services) - - service_units = CliCommandType( - operations_tmpl='azure.mgmt.deploymentmanager.operations#ServiceUnitsOperations.{}', - client_factory=cf_service_units) - - artifact_sources = CliCommandType( - operations_tmpl='azure.mgmt.deploymentmanager.operations#ArtifactSourcesOperations.{}', - client_factory=cf_artifact_sources) - - steps = CliCommandType( - operations_tmpl='azure.mgmt.deploymentmanager.operations#StepsOperations.{}', - client_factory=cf_steps) - - rollouts = CliCommandType( - operations_tmpl='azure.mgmt.deploymentmanager.operations#RolloutsOperations.{}', - client_factory=cf_rollouts) - - custom_tmpl = 'azure.cli.command_modules.deploymentmanager.custom#{}' - deployment_manager_custom = CliCommandType(operations_tmpl=custom_tmpl) - - with self.command_group('deploymentmanager artifact-source', artifact_sources) as g: - g.custom_command('create', 'cli_artifact_source_create') - g.command('delete', 'delete', confirmation="There might be rollouts referencing the artifact source. Do you want to delete?") - g.show_command('show', 'get') - g.command('list', 'list') - g.generic_update_command( - 'update', - setter_arg_name='artifact_source_info', - custom_func_name='cli_artifact_source_update', - custom_func_type=deployment_manager_custom) - - with self.command_group('deploymentmanager service-topology', service_topologies) as g: - g.custom_command('create', 'cli_service_topology_create') - g.command('delete', 'delete') - g.show_command('show', 'get') - g.command('list', 'list') - g.generic_update_command( - 'update', - setter_arg_name='service_topology_info', - custom_func_name='cli_service_topology_update', - custom_func_type=deployment_manager_custom) - - with self.command_group('deploymentmanager service', services) as g: - g.custom_command('create', 'cli_service_create') - g.command('delete', 'delete') - g.show_command('show', 'get') - g.command('list', 'list') - g.generic_update_command( - 'update', - setter_arg_name='service_info', - custom_func_name='cli_service_update', - custom_func_type=deployment_manager_custom) - - with self.command_group('deploymentmanager service-unit', service_units) as g: - g.custom_command('create', 'cli_service_unit_create') - g.command('delete', 'delete') - g.show_command('show', 'get') - g.command('list', 'list') - g.generic_update_command( - 'update', - setter_arg_name='service_unit_info', - custom_func_name='cli_service_unit_update', - custom_func_type=deployment_manager_custom) - - with self.command_group('deploymentmanager step', steps) as g: - g.custom_command('create', 'cli_step_create') - g.command('delete', 'delete') - g.show_command('show', 'get') - g.command('list', 'list') - g.generic_update_command( - 'update', - setter_arg_name='step_info', - custom_func_name='cli_step_update', - custom_func_type=deployment_manager_custom) - - with self.command_group('deploymentmanager rollout', rollouts) as g: - g.show_command('show', 'get') - g.command('list', 'list') - g.command('stop', 'cancel', confirmation="Do you want to cancel the rollout?") - g.custom_command( - 'restart', - 'cli_rollout_restart', - confirmation="Are you sure you want to restart the rollout? If you want to skip all the steps that succeeded on the previous run, use '--skip-succeeded' option.") - g.command('delete', 'delete') - - with self.command_group('deploymentmanager', is_preview=True): - pass diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/custom.py b/src/azure-cli/azure/cli/command_modules/deploymentmanager/custom.py deleted file mode 100644 index 390aeb57e76..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/custom.py +++ /dev/null @@ -1,408 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -import json -import os -from knack.log import get_logger -from knack.util import CLIError - -from azure.cli.core.util import get_file_json, shell_safe_json_parse - -from azure.cli.command_modules.deploymentmanager._client_factory import ( - cf_artifact_sources, - cf_service_topologies, - cf_services, - cf_service_units, - cf_steps, - cf_rollouts) - -from azure.mgmt.deploymentmanager.models import ( - SasAuthentication, - ArtifactSource, - ServiceTopologyResource, - ServiceResource, - ServiceUnitResource, - ServiceUnitArtifacts, - StepResource, - WaitStepProperties, - WaitStepAttributes) - -logger = get_logger(__name__) - - -# pylint: disable=unused-argument -def cli_artifact_source_create( - cmd, - resource_group_name, - artifact_source_name, - sas_uri, - artifact_root=None, - location=None, - tags=None): - - if location is None: - location = get_location_from_resource_group(cmd.cli_ctx, resource_group_name) - - sasAuthentication = SasAuthentication(sas_uri=sas_uri) - artifact_source = ArtifactSource( - source_type="AzureStorage", - artifact_root=artifact_root, - authentication=sasAuthentication, - location=location, - tags=tags) - - client = cf_artifact_sources(cmd.cli_ctx) - return client.create_or_update( - resource_group_name=resource_group_name, - artifact_source_name=artifact_source_name, - artifact_source_info=artifact_source) - - -def cli_artifact_source_update( - cmd, - instance, - sas_uri=None, - artifact_root=None, - tags=None): - - if sas_uri: - sasAuthentication = SasAuthentication(sas_uri=sas_uri) - instance.authentication = sasAuthentication - - instance.artifact_root = artifact_root - instance.tags = tags - - return instance - - -def cli_service_topology_create( - cmd, - resource_group_name, - service_topology_name, - artifact_source=None, - location=None, - tags=None): - - if location is None: - location = get_location_from_resource_group(cmd.cli_ctx, resource_group_name) - - if artifact_source is not None: - from azure.cli.core.commands.client_factory import get_subscription_id - from msrestazure.tools import is_valid_resource_id, resource_id - - if not is_valid_resource_id(artifact_source): - artifact_source = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=resource_group_name, - namespace='Microsoft.DeploymentManager', type='artifactSources', - name=artifact_source) - - service_topology = ServiceTopologyResource( - artifact_source_id=artifact_source, - location=location, - tags=tags) - client = cf_service_topologies(cmd.cli_ctx) - return client.create_or_update( - resource_group_name=resource_group_name, - service_topology_name=service_topology_name, - service_topology_info=service_topology) - - -def cli_service_topology_update( - cmd, - instance, - resource_group_name, - artifact_source=None, - tags=None): - - if artifact_source is not None: - - from azure.cli.core.commands.client_factory import get_subscription_id - from msrestazure.tools import is_valid_resource_id, resource_id - - if not is_valid_resource_id(artifact_source): - artifact_source = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=resource_group_name, - namespace='Microsoft.DeploymentManager', type='artifactSources', - name=artifact_source) - - instance.artifact_source_id = artifact_source - - if tags is not None: - instance.tags = tags - - return instance - - -def cli_service_create( - cmd, - resource_group_name, - service_topology_name, - service_name, - target_location, - target_subscription_id, - location=None, - tags=None): - - if location is None: - location = get_location_from_resource_group(cmd.cli_ctx, resource_group_name) - - service = ServiceResource( - target_location=target_location, - target_subscription_id=target_subscription_id, - location=location, - tags=tags) - client = cf_services(cmd.cli_ctx) - return client.create_or_update( - resource_group_name=resource_group_name, - service_topology_name=service_topology_name, - service_name=service_name, - service_info=service) - - -def cli_service_update( - cmd, - instance, - target_location=None, - target_subscription_id=None, - tags=None): - - if target_location is not None: - instance.target_location = target_location - - if target_subscription_id is not None: - instance.target_subscription_id = target_subscription_id - - if tags is not None: - instance.tags = tags - - return instance - - -def cli_service_unit_create( - cmd, - resource_group_name, - service_topology_name, - service_name, - service_unit_name, - target_resource_group, - deployment_mode, - parameters_path, - template_path, - location=None, - tags=None): - parameters_uri = None - template_uri = None - parameters_artifact_source_relative_path = None - template_artifact_source_relative_path = None - - if parameters_path is not None: - if parameters_path.startswith('http'): - parameters_uri = parameters_path - else: - parameters_artifact_source_relative_path = parameters_path - - if template_path is not None: - if template_path.startswith('http'): - template_uri = template_path - else: - template_artifact_source_relative_path = template_path - - if (all([template_artifact_source_relative_path, parameters_uri]) or all([parameters_artifact_source_relative_path, template_uri])): # pylint: disable=line-too-long - raise CLIError('usage error: specify both "--template-path" and "--parameters-path" either as relative URIs to artifact source or absolute SAS URIs.') # pylint: disable=line-too-long - - if location is None: - location = get_location_from_resource_group(cmd.cli_ctx, resource_group_name) - - service_unit_artifacts = ServiceUnitArtifacts( - parameters_uri=parameters_uri, - template_uri=template_uri, - parameters_artifact_source_relative_path=parameters_artifact_source_relative_path, - template_artifact_source_relative_path=template_artifact_source_relative_path) - - service_unit = ServiceUnitResource( - target_resource_group=target_resource_group, - deployment_mode=deployment_mode, - artifacts=service_unit_artifacts, - location=location, - tags=tags) - - client = cf_service_units(cmd.cli_ctx) - return client.create_or_update( - resource_group_name=resource_group_name, - service_topology_name=service_topology_name, - service_name=service_name, - service_unit_name=service_unit_name, - service_unit_info=service_unit) - - -def cli_service_unit_update( - cmd, - instance, - target_resource_group=None, - deployment_mode=None, - parameters_path=None, - template_path=None, - tags=None): - - if target_resource_group is not None: - instance.target_resource_group = target_resource_group - - if deployment_mode is not None: - instance.deployment_mode = deployment_mode - - if parameters_path is not None: - if parameters_path.startswith('http'): - instance.parameters_uri = parameters_path - else: - instance.parameters_artifact_source_relative_path = parameters_path - - if template_path is not None: - if template_path.startswith('http'): - instance.template_uri = template_path - else: - instance.template_artifact_source_relative_path = template_path - - if tags is not None: - instance.tags = tags - - return instance - - -def cli_step_create( - cmd, - resource_group_name, - step_name=None, - step=None, - duration=None, - location=None, - tags=None): - - if step is None and duration is None: - raise CLIError('usage error: specify either step or duration. \ - If step is specified, it can either be a wait step or health check step.') - - if step is not None and duration is not None: - raise CLIError('usage error: specify only one of step or duration. \ - If step is specified, it can either be a wait step or health check step.') - - client = cf_steps(cmd.cli_ctx) - if step is not None: - step_resource = get_step_from_json(client, step) - step_name = step_resource.name - - elif duration is not None: - if step_name is None: - raise CLIError('usage error: step name is not specified.') - - waitStepProperties = WaitStepProperties(attributes=WaitStepAttributes(duration=duration)) - - if location is None: - if resource_group_name is not None: - location = get_location_from_resource_group(cmd.cli_ctx, resource_group_name) - - step_resource = StepResource( - properties=waitStepProperties, - location=location, - tags=tags) - - return client.create_or_update( - resource_group_name=resource_group_name, - step_name=step_name, - step_info=step_resource) - - -def cli_step_update( - cmd, - instance, - step=None, - duration=None, - tags=None): - - if (step is None and duration is None): - raise CLIError('usage error: specify either step or duration. \ - If step is specified, it can either be a wait step or health check step.') - - if (step is not None and duration is not None): - raise CLIError('usage error: specify only one of step or duration. \ - If step is specified, it can either be a wait step or health check step.') - - if duration is not None: - instance.properties.attributes.duration = duration - - # only update tags if updating duration property. If updating step from a file, read everything from file. - if tags is not None: - instance.tags = tags - - elif step is not None: - client = cf_steps(cmd.cli_ctx) - step_resource = get_step_from_json(client, step) - instance = step_resource - - return instance - - -def cli_rollout_restart( - cmd, - resource_group_name, - rollout_name, - skip_succeeded=False): - - client = cf_rollouts(cmd.cli_ctx) - return client.restart( - resource_group_name=resource_group_name, - rollout_name=rollout_name, - skip_succeeded=bool(skip_succeeded)) - - -def get_location_from_resource_group(cli_ctx, resource_group_name): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.cli.core.profiles import ResourceType - client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES) - group = client.resource_groups.get(resource_group_name) - return group.location - - -def get_step_from_json(client, health_check_step): - return get_object_from_json(client, health_check_step, 'StepResource') - - -def get_or_read_json(json_or_file): - json_obj = None - if is_json(json_or_file): - json_obj = shell_safe_json_parse(json_or_file) - elif os.path.exists(json_or_file): - json_obj = get_file_json(json_or_file) - if json_obj is None: - raise ValueError( - """ - The variable passed should be in valid JSON format and be supplied by az deploymentmanager step CLI command. - Make sure that you use output of relevant 'az deploymentmanager step show' command and the --out is 'json' - """) - return json_obj - - -def get_object_from_json(client, json_or_file, class_name): - # Determine if input is json or file - json_obj = get_or_read_json(json_or_file) - - # Deserialize json to object - param = client._deserialize(class_name, json_obj) # pylint: disable=protected-access - if param is None: - raise ValueError( - """ - The variable passed should be in valid JSON format and be supplied by az deploymentmanager step CLI command. - Make sure that you use output of relevant 'az deploymentmanager step show' commands and the --out is 'json' - """) - return param - - -def is_json(content): - try: - json.loads(content) - except ValueError: - return False - return True diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/__init__.py b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/__init__.py deleted file mode 100644 index 34913fb394d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/__init__.py b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/__init__.py deleted file mode 100644 index 34913fb394d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.copy.parameters.json b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.copy.parameters.json deleted file mode 100644 index 72334e91416..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.copy.parameters.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "location": { - "value": "centralus" - }, - "storageAccountName": { - "value": "cliadmxy32gystgtemplate" - }, - "accountType": { - "value": "Standard_RAGRS" - }, - "kind": { - "value": "StorageV2" - }, - "accessTier": { - "value": "Hot" - }, - "supportsHttpsTrafficOnly": { - "value": true - } - } -} diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.copy.template.json b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.copy.template.json deleted file mode 100644 index f6e275dbcb0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.copy.template.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "location": { - "type": "string" - }, - "storageAccountName": { - "type": "string" - }, - "accountType": { - "type": "string" - }, - "kind": { - "type": "string" - }, - "accessTier": { - "type": "string" - }, - "supportsHttpsTrafficOnly": { - "type": "bool" - } - }, - "variables": {}, - "resources": [ - { - "name": "[parameters('storageAccountName')]", - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "2018-07-01", - "location": "[parameters('location')]", - "properties": { - "accessTier": "[parameters('accessTier')]", - "supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]" - }, - "dependsOn": [], - "sku": { - "name": "[parameters('accountType')]" - }, - "kind": "[parameters('kind')]" - } - ], - "outputs": {} -} \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.parameters.json b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.parameters.json deleted file mode 100644 index da49534c3b8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.parameters.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "location": { - "value": "centralus" - }, - "storageAccountName": { - "value": "cliadmxy32gystgtemplate" - }, - "accountType": { - "value": "Standard_RAGRS" - }, - "kind": { - "value": "StorageV2" - }, - "accessTier": { - "value": "Hot" - }, - "supportsHttpsTrafficOnly": { - "value": true - } - } -} \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.template.json b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.template.json deleted file mode 100644 index f6e275dbcb0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage.template.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "location": { - "type": "string" - }, - "storageAccountName": { - "type": "string" - }, - "accountType": { - "type": "string" - }, - "kind": { - "type": "string" - }, - "accessTier": { - "type": "string" - }, - "supportsHttpsTrafficOnly": { - "type": "bool" - } - }, - "variables": {}, - "resources": [ - { - "name": "[parameters('storageAccountName')]", - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "2018-07-01", - "location": "[parameters('location')]", - "properties": { - "accessTier": "[parameters('accessTier')]", - "supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]" - }, - "dependsOn": [], - "sku": { - "name": "[parameters('accountType')]" - }, - "kind": "[parameters('kind')]" - } - ], - "outputs": {} -} \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage_invalid.parameters.json b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage_invalid.parameters.json deleted file mode 100644 index 309b5a27068..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/artifactroot/storage_invalid.parameters.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "location": { - "value": "centralus" - }, - "storageAccountName": { - "value": "(Invalid_Storage.Account/Name)" - }, - "accountType": { - "value": "Standard_RAGRS" - }, - "kind": { - "value": "StorageV2" - }, - "accessTier": { - "value": "Hot" - }, - "supportsHttpsTrafficOnly": { - "value": true - } - } -} \ No newline at end of file diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/createrollout.json b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/createrollout.json deleted file mode 100644 index d1138226796..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/createrollout.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", - "resources": [ - { - "location": "Central US", - "apiVersion": "2018-09-01-preview", - "type": "Microsoft.DeploymentManager/rollouts", - "name": "cliadmxd57xgRollout", - "Identity": { - "type": "userAssigned", - "identityIds": [ - "/subscriptions/53012dcb-5039-4e96-8e6c-5d913da1cdb5/resourcegroups/cliadmxd57xg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cliadmxd57xgIdentity" - ] - }, - "properties": { - "buildVersion": "1.0.0", - "targetServiceTopologyId": "/subscriptions/53012dcb-5039-4e96-8e6c-5d913da1cdb5/resourcegroups/cliadmxd57xg/providers/Microsoft.DeploymentManager/serviceTopologies/cliadmxd57xgServiceTopology", - "artifactSourceId": "/subscriptions/53012dcb-5039-4e96-8e6c-5d913da1cdb5/resourcegroups/cliadmxd57xg/providers/Microsoft.DeploymentManager/artifactSources/cliadmxd57xgArtifactSource", - "stepGroups": [ - { - "name": "PilotRegion", - "preDeploymentSteps": [ - { - "stepId": "/subscriptions/53012dcb-5039-4e96-8e6c-5d913da1cdb5/resourcegroups/cliadmxd57xg/providers/Microsoft.DeploymentManager/steps/cliadmxd57xgWaitStep" - } - ], - "deploymentTargetId": "/subscriptions/53012dcb-5039-4e96-8e6c-5d913da1cdb5/resourcegroups/cliadmxd57xg/providers/Microsoft.DeploymentManager/serviceTopologies/cliadmxd57xgServiceTopology/services/cliadmxd57xgService/serviceUnits/cliadmxd57xgServiceUnit" - } - ] - } - } - ], - "contentVersion": "1.0.0.0" -} diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/createrollout_failurerollout.json b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/createrollout_failurerollout.json deleted file mode 100644 index 4c0a11a56c6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/createrollout_failurerollout.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", - "resources": [ - { - "location": "Central US", - "apiVersion": "2018-09-01-preview", - "type": "Microsoft.DeploymentManager/rollouts", - "name": "cliadmxd57xgInvalidRollout", - "Identity": { - "type": "userAssigned", - "identityIds": [ - "/subscriptions/53012dcb-5039-4e96-8e6c-5d913da1cdb5/resourcegroups/cliadmxd57xg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cliadmxd57xgIdentity" - ] - }, - "properties": { - "buildVersion": "1.0.0", - "targetServiceTopologyId": "/subscriptions/53012dcb-5039-4e96-8e6c-5d913da1cdb5/resourcegroups/cliadmxd57xg/providers/Microsoft.DeploymentManager/serviceTopologies/cliadmxd57xgServiceTopology", - "artifactSourceId": "/subscriptions/53012dcb-5039-4e96-8e6c-5d913da1cdb5/resourcegroups/cliadmxd57xg/providers/Microsoft.DeploymentManager/artifactSources/cliadmxd57xgArtifactSource", - "stepGroups": [ - { - "name": "PilotRegion", - "deploymentTargetId": "/subscriptions/53012dcb-5039-4e96-8e6c-5d913da1cdb5/resourcegroups/cliadmxd57xg/providers/Microsoft.DeploymentManager/serviceTopologies/cliadmxd57xgServiceTopology/services/cliadmxd57xgService/serviceUnits/cliadmxd57xgInvalidServiceUnit" - } - ] - } - } - ], - "contentVersion": "1.0.0.0" -} diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/healthcheck_step.json b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/healthcheck_step.json deleted file mode 100644 index 18a43d22ea0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/healthcheck_step.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "__HEALTH_CHECK_STEP_NAME__", - "location": "centralus", - "properties": { - "stepType": "HealthCheck", - "attributes": { - "healthChecks": [ - { - "name": "RestHealthQuery1", - "request": { - "authentication": { - "in": "Query", - "name": "Code", - "type": "ApiKey", - "value": "AuthValue==" - }, - "method": "Get", - "uri": "https://clientvalidations.deploymentmanager.net/applications/healthcheck1/healthstatus" - }, - "response": { - "regex": { - "matchQuantifier": "All", - "matches": ["resthc1", "healthy"] - }, - "successStatusCodes": ["OK"] - } - }, - { - "name": "RestHealthQuery2", - "request": { - "authentication": { - "in": "Header", - "name": "x-functions-key", - "type": "ApiKey", - "value": "AuthValue==" - }, - "method": "Get", - "uri": "https://clientvalidations.deploymentmanager.net/applications/healthcheck2/healthStatus" - }, - "response": { - "regex": { - "matchQuantifier": "All", - "matches": ["resthc1", "healthy"] - }, - "successStatusCodes": ["OK"] - } - } - ], - "healthyStateDuration": "PT60M", - "maxElasticDuration": "PT20M", - "waitDuration": "PT10M", - "type": "REST" - } - }, - "tags": null -} diff --git a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/test_deploymentmanager_scenario.py b/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/test_deploymentmanager_scenario.py deleted file mode 100644 index 7bcc10721f3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/deploymentmanager/tests/latest/test_deploymentmanager_scenario.py +++ /dev/null @@ -1,864 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -import os -import json -import os -import platform -import tempfile -import time -import fileinput -import unittest - -from azure.cli.testsdk import ( - ScenarioTest, - ResourceGroupPreparer, - StorageAccountPreparer) - -from msrestazure.azure_exceptions import CloudError -from azure.cli.testsdk.scenario_tests import AllowLargeResponse - -name_prefix = 'cliadm' -resource_location = 'centralus' -TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) -curr_dir = os.path.dirname(os.path.realpath(__file__)) - -create_rollout_template = os.path.join(curr_dir, "createrollout.json").replace('\\', '\\\\') -failure_create_rollout_template = os.path.join(curr_dir, "createrollout_failurerollout.json").replace('\\', '\\\\') -healthcheck_file_path = os.path.join(curr_dir, "healthcheck_step.json").replace('\\', '\\\\') - -parameters_file_name = "storage.parameters.json" -invalid_parameters_file_name = "storage_invalid.parameters.json" -template_file_name = "storage.template.json" -params_copy_file_name = "storage.copy.parameters.json" -template_copy_file_name = "storage.copy.template.json" -path_to_tests = ".\\azure\\cli\\command_modules\\deploymentmanager\\tests\\latest\\" -artifact_root = "artifactroot" - -parametersArtifactSourceRelativePath = os.path.join(curr_dir, artifact_root, parameters_file_name) -templateArtifactSourceRelativePath = os.path.join(curr_dir, artifact_root, template_file_name) -invalidParametersArtifactSourceRelativePath = os.path.join(curr_dir, artifact_root, invalid_parameters_file_name) -parametersCopyArtifactSourceRelativePath = os.path.join(curr_dir, artifact_root, params_copy_file_name) -templateCopyArtifactSourceRelativePath = os.path.join(curr_dir, artifact_root, template_copy_file_name) - - -class DeploymentManagerTests(ScenarioTest): - - @unittest.skip('Deployment failed') - @ResourceGroupPreparer(name_prefix=name_prefix, random_name_length=12, location=resource_location) - @StorageAccountPreparer(name_prefix=name_prefix, location=resource_location) - @AllowLargeResponse() - def test_deploymentmanager_scenario(self, resource_group, storage_account): - - subscription_id = self.get_subscription_id() - artifact_source_name = resource_group + "ArtifactSource" - updated_artifact_source_name = resource_group + "ArtifactSourceUpdated" - location = resource_location - - self.assertFalse(location is None) - - self.set_managed_identity(subscription_id, resource_group) - - artifact_source_id = self.new_artifact_source( - resource_group, - storage_account, - artifact_source_name, - location, - True) - - self.service_topology_validations( - subscription_id, - resource_group, - location, - artifact_source_id, - updated_artifact_source_name, - storage_account) - - self.list_artifact_sources(resource_group, artifact_source_name) - - self.delete_artifact_source(resource_group, artifact_source_name) - self.delete_artifact_source(resource_group, updated_artifact_source_name) - - def service_topology_validations( - self, - subscription_id, - resource_group_name, - location, - artifact_source_id, - updated_artifact_source_name, - storage_account_name): - - topology_name = resource_group_name + "ServiceTopology" - topology2_name = resource_group_name + "ServiceTopology2" - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': topology_name, - 'as_id': artifact_source_id, - } - - self.cmd('deploymentmanager service-topology create -g {rg} -n {st_name} -l \"{location}\" --artifact-source {as_id}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/serviceTopologies'), - self.check('name', topology_name), - self.check('artifactSourceId', artifact_source_id)]) - - service_topology_id = self.cmd('deploymentmanager service-topology show -g {rg} -n {st_name}').get_output_in_json()['id'] - self.services_validations( - resource_group_name, - location, - artifact_source_id, - service_topology_id, - topology_name, - subscription_id - ) - - updated_artifact_source_id = self.new_artifact_source( - resource_group_name, - storage_account_name, - updated_artifact_source_name, - location, - False) - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': topology_name, - 'as_id': updated_artifact_source_id, - } - - self.cmd('deploymentmanager service-topology update -g {rg} -n {st_name} --artifact-source {as_id}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/serviceTopologies'), - self.check('name', topology_name), - self.check('artifactSourceId', updated_artifact_source_id)]) - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': topology2_name, - 'as_id': artifact_source_id, - } - - self.cmd('deploymentmanager service-topology create -g {rg} -n {st_name} -l \"{location}\" --artifact-source {as_id}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/serviceTopologies'), - self.check('name', topology2_name), - self.check('artifactSourceId', artifact_source_id)]) - - self.list_service_topologies(resource_group_name, topology_name) - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': topology_name, - 'as_id': artifact_source_id, - } - - self.cmd('deploymentmanager service-topology delete -g {rg} -n {st_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager service-topology show -n {st_name} -g {rg}') - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': topology2_name, - 'as_id': artifact_source_id, - } - - self.cmd('deploymentmanager service-topology delete -g {rg} -n {st_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager service-topology show -n {st_name} -g {rg}') - - def services_validations( - self, - resource_group_name, - location, - artifact_source_id, - service_topology_id, - service_topology_name, - subscription_id): - - service_name = resource_group_name + "Service" - service2_name = resource_group_name + "Service2" - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': service_topology_name, - 's_name': service_name, - 's2_name': service2_name, - 't_l': location, - 't_sub_id': subscription_id - } - - self.cmd('deploymentmanager service create -g {rg} --service-topology-name {st_name} -n {s_name} -l \"{location}\" --target-location \"{t_l}\" --target-subscription-id {t_sub_id}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/serviceTopologies/services'), - self.check('name', service_name), - self.check('targetLocation', location)]) - self.service_units_validations( - resource_group_name, - location, - artifact_source_id, - service_topology_id, - service_topology_name, - service_name - ) - - # dummy subscription id created for testing. No resources are created in this. - updated_target_subscription_id = "29843263-a568-4db8-899f-10977b9d5c7b" - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': service_topology_name, - 's_name': service_name, - 's2_name': service2_name, - 't_l': location, - 't_sub_id': updated_target_subscription_id - } - - self.cmd('deploymentmanager service update -g {rg} --service-topology-name {st_name} -n {s_name} --target-subscription-id {t_sub_id}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/serviceTopologies/services'), - self.check('name', service_name), - self.check('targetSubscriptionId', updated_target_subscription_id)]) - - self.cmd('deploymentmanager service create -g {rg} --service-topology-name {st_name} -n {s2_name} -l \"{location}\" --target-location \"{t_l}\" --target-subscription-id {t_sub_id}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/serviceTopologies/services'), - self.check('name', service2_name), - self.check('targetLocation', location)]) - - self.list_services(resource_group_name, service_topology_name, service_name) - - self.kwargs = { - 'rg': resource_group_name, - 'st_name': service_topology_name, - 's_name': service_name, - 's2_name': service2_name, - } - - self.cmd('deploymentmanager service delete -g {rg} --service-topology-name {st_name} -n {s_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager service show -g {rg} --service-topology-name {st_name} -n {s_name}') - - self.cmd('deploymentmanager service delete -g {rg} --service-topology-name {st_name} -n {s2_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager service show -g {rg} --service-topology-name {st_name} -n {s2_name}') - - def service_units_validations( - self, - resource_group_name, - location, - artifact_source_id, - service_topology_id, - service_topology_name, - service_name): - - service_unit_name = resource_group_name + "ServiceUnit" - deployment_mode = "Incremental" - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': service_topology_name, - 's_name': service_name, - 'su_name': service_unit_name, - 'd_mode': deployment_mode, - 'p_path': parameters_file_name, - 't_path': template_file_name - } - - self.cmd('deploymentmanager service-unit create -g {rg} --service-topology-name {st_name} --service-name {s_name} -n {su_name} -l \"{location}\" --target-resource-group {rg} --deployment-mode {d_mode} --parameters-path {p_path} --template-path {t_path}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/serviceTopologies/services/serviceUnits'), - self.check('name', service_unit_name), - self.check('artifacts.parametersArtifactSourceRelativePath', parameters_file_name), - self.check('artifacts.templateArtifactSourceRelativePath', template_file_name), - self.check('deploymentMode', deployment_mode), - self.check('targetResourceGroup', resource_group_name)]) - - service_unit_id = self.cmd('deploymentmanager service-unit show -g {rg} --service-topology-name {st_name} --service-name {s_name} -n {su_name}').get_output_in_json()['id'] - - # Create a service unit that is invalid to test rollout failure operations - invalid_service_unit_name = resource_group_name + "InvalidServiceUnit" - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': service_topology_name, - 's_name': service_name, - 'su_name': invalid_service_unit_name, - 'd_mode': deployment_mode, - 'p_path': invalid_parameters_file_name, - 't_path': template_file_name - } - - self.cmd('deploymentmanager service-unit create -g {rg} --service-topology-name {st_name} --service-name {s_name} -n {su_name} -l \"{location}\" --target-resource-group {rg} --deployment-mode {d_mode} --parameters-path {p_path} --template-path {t_path}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/serviceTopologies/services/serviceUnits'), - self.check('name', invalid_service_unit_name), - self.check('artifacts.parametersArtifactSourceRelativePath', invalid_parameters_file_name), - self.check('artifacts.templateArtifactSourceRelativePath', template_file_name), - self.check('deploymentMode', deployment_mode), - self.check('targetResourceGroup', resource_group_name)]) - - invalid_service_unit_id = self.cmd('deploymentmanager service-unit show -g {rg} --service-topology-name {st_name} --service-name {s_name} -n {su_name}').get_output_in_json()['id'] - self.steps_validations( - resource_group_name, - location, - artifact_source_id, - service_topology_id, - service_topology_name, - service_unit_id, - invalid_service_unit_id) - - deployment_mode = "Complete" - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'st_name': service_topology_name, - 's_name': service_name, - 'su_name': service_unit_name, - 'd_mode': deployment_mode, - 'p_path': parameters_file_name, - 't_path': template_file_name - } - - self.cmd('deploymentmanager service-unit update -g {rg} --service-topology-name {st_name} --service-name {s_name} -n {su_name} --deployment-mode {d_mode}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/serviceTopologies/services/serviceUnits'), - self.check('name', service_unit_name), - self.check('deploymentMode', deployment_mode)]) - - self.list_service_units(resource_group_name, service_topology_name, service_name, service_unit_name) - - self.kwargs = { - 'rg': resource_group_name, - 'st_name': service_topology_name, - 's_name': service_name, - 'su_name': service_unit_name, - } - - self.cmd('deploymentmanager service-unit delete -g {rg} --service-topology-name {st_name} --service-name {s_name} -n {su_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager service-unit show -g {rg} --service-topology-name {st_name} --service-name {s_name} -n {su_name}') - - self.kwargs = { - 'rg': resource_group_name, - 'st_name': service_topology_name, - 's_name': service_name, - 'su_name': invalid_service_unit_name, - } - - self.cmd('deploymentmanager service-unit delete -g {rg} --service-topology-name {st_name} --service-name {s_name} -n {su_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager service-unit show -g {rg} --service-topology-name {st_name} --service-name {s_name} -n {su_name}') - - def steps_validations( - self, - resource_group_name, - location, - artifact_source_id, - service_topology_id, - service_topology_name, - service_unit_id, - invalid_service_unit_id): - - step_name = resource_group_name + "WaitStep" - duration = "PT5M" - updated_duration = "PT10M" - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'step_name': step_name, - 'duration': duration - } - - self.cmd('deploymentmanager step create -g {rg} -l \"{location}\" -n {step_name} --duration {duration}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/steps'), - self.check('name', step_name), - self.check('properties.stepType', 'Wait'), - self.check('properties.attributes.duration', duration)]) - - step_id = self.cmd('deploymentmanager step show -g {rg} -n {step_name}').get_output_in_json()['id'] - - self.rollouts_validations( - resource_group_name, - location, - artifact_source_id, - service_topology_id, - service_unit_id, - invalid_service_unit_id, - step_id - ) - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'step_name': step_name, - 'duration': updated_duration - } - - self.cmd('deploymentmanager step update -g {rg} -n {step_name} --duration {duration}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/steps'), - self.check('name', step_name), - self.check('properties.attributes.duration', updated_duration)]) - - self.healthcheck_step_validations(resource_group_name, location) - - self.kwargs = { - 'rg': resource_group_name, - 'step_name': step_name - } - - self.cmd('deploymentmanager step delete -g {rg} -n {step_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager step show -g {rg} -n {step_name}') - - def healthcheck_step_validations( - self, - resource_group_name, - location): - - step_name = resource_group_name + "RestHealthCheckStep" - updated_healthy_state_duration = "PT30M" - - self.replace_string("__HEALTH_CHECK_STEP_NAME__", step_name, healthcheck_file_path, True) - - self.kwargs = { - 'rg': resource_group_name, - 'step_name': step_name, - 'rest_health_check_file': healthcheck_file_path, - 'healthy_state_duration': updated_healthy_state_duration - } - - json_obj = None - with open(healthcheck_file_path) as f: - json_obj = json.load(f) - - self.cmd('deploymentmanager step create -g {rg} --step "{rest_health_check_file}"', checks=[ - self.check('type', 'Microsoft.DeploymentManager/steps'), - self.check('name', step_name), - self.check('properties.stepType', 'HealthCheck'), - self.check('properties.attributes.waitDuration', json_obj['properties']['attributes']['waitDuration']), - self.check('properties.attributes.maxElasticDuration', json_obj['properties']['attributes']['maxElasticDuration']), - self.check('properties.attributes.healthyStateDuration', json_obj['properties']['attributes']['healthyStateDuration'])]) - - step_id = self.cmd('deploymentmanager step show -g {rg} -n {step_name}').get_output_in_json()['id'] - self.assertFalse(step_id is None) - - # Revert health check file change for playback mode. - self.replace_string(step_name, "__HEALTH_CHECK_STEP_NAME__", healthcheck_file_path, True) - - json_obj['properties']['attributes']['healthyStateDuration'] = updated_healthy_state_duration - - serialized_json = json.dumps(json_obj) - self.assertFalse(serialized_json is None) - - self.kwargs = { - 'rg': resource_group_name, - 'step_name': step_name, - 'step': serialized_json - } - - self.cmd('deploymentmanager step update -g {rg} -n {step_name} --step \'{step}\'', checks=[ - self.check('type', 'Microsoft.DeploymentManager/steps'), - self.check('name', step_name), - self.check('properties.attributes.healthyStateDuration', updated_healthy_state_duration)]) - - step2_name = resource_group_name + "RestHealthCheckStep2" - json_obj['name'] = step2_name - - serialized_json = json.dumps(json_obj) - self.assertFalse(serialized_json is None) - - self.kwargs = { - 'rg': resource_group_name, - 'step': serialized_json - } - - self.cmd('deploymentmanager step create -g {rg} --step \'{step}\'', checks=[ - self.check('type', 'Microsoft.DeploymentManager/steps'), - self.check('name', step2_name), - self.check('properties.stepType', 'HealthCheck'), - self.check('properties.attributes.healthyStateDuration', updated_healthy_state_duration)]) - - self.list_steps(resource_group_name, step_name) - - self.kwargs = { - 'rg': resource_group_name, - 'step_name': step_name - } - - self.cmd('deploymentmanager step delete -g {rg} -n {step_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager step show -g {rg} -n {step_name}') - - self.kwargs = { - 'rg': resource_group_name, - 'step2_name': step2_name - } - - self.cmd('deploymentmanager step delete -g {rg} -n {step2_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager step show -g {rg} -n {step2_name}') - - def rollouts_validations( - self, - resource_group_name, - location, - artifact_source_id, - service_topology_id, - service_unit_id, - invalid_service_unit_id, - step_id): - - rollout_name = resource_group_name + "Rollout" - failed_rollout_name = resource_group_name + "InvalidRollout" - - self.replace_rollout_placeholders( - rollout_name, - service_topology_id, - artifact_source_id, - step_id, - service_unit_id, - create_rollout_template - ) - - self.replace_rollout_placeholders( - failed_rollout_name, - service_topology_id, - artifact_source_id, - step_id, - invalid_service_unit_id, - failure_create_rollout_template - ) - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 't_path': create_rollout_template, - 'invalid_t_path': failure_create_rollout_template, - 'rollout_name': rollout_name, - 'failed_rollout_name': failed_rollout_name - } - - self.cmd('group deployment create -g {rg} --template-file "{t_path}"', checks=[ - self.check('properties.provisioningState', 'Succeeded')]) - - self.cmd('deploymentmanager rollout show -g {rg} -n {rollout_name}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/rollouts'), - self.check('status', 'Running'), - self.check('totalRetryAttempts', '0'), - self.check('operationInfo.retryAttempt', '0'), - self.check('artifactSourceId', artifact_source_id), - self.check('targetServiceTopologyId', service_topology_id)]) - - self.cmd('deploymentmanager rollout stop -g {rg} -n {rollout_name} --yes', checks=[ - self.check('type', 'Microsoft.DeploymentManager/rollouts'), - self.check('status', 'Canceling')]) - - while True: - self.sleep(120) - rollout = self.cmd('deploymentmanager rollout show -g {rg} -n {rollout_name}').get_output_in_json() - if (rollout['status'] != 'Canceling'): - break - - self.assertEqual('Canceled', rollout['status']) - - self.cmd('group deployment create -g {rg} --template-file "{invalid_t_path}"', checks=[ - self.check('properties.provisioningState', 'Succeeded')]) - - self.cmd('deploymentmanager rollout show -g {rg} -n {failed_rollout_name}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/rollouts'), - self.check('totalRetryAttempts', '0'), - self.check('operationInfo.retryAttempt', '0'), - self.check('artifactSourceId', artifact_source_id), - self.check('targetServiceTopologyId', service_topology_id)]) - - # Now validate that the rollout expected to fail has failed. - while True: - self.sleep(120) - failed_rollout = self.cmd('deploymentmanager rollout show -g {rg} -n {failed_rollout_name}').get_output_in_json() - if (failed_rollout['status'] != 'Running'): - break - - self.assertEqual('Failed', failed_rollout['status']) - - self.cmd('deploymentmanager rollout restart -g {rg} -n {failed_rollout_name} --skip-succeeded --yes', checks=[ - self.check('type', 'Microsoft.DeploymentManager/rollouts'), - self.check('operationInfo.retryAttempt', '1'), - self.check('operationInfo.skipSucceededOnRetry', True), - self.check('status', 'Running')]) - - self.cmd('deploymentmanager rollout stop -g {rg} -n {failed_rollout_name} --yes', checks=[ - self.check('type', 'Microsoft.DeploymentManager/rollouts'), - self.check('operationInfo.retryAttempt', '1'), - self.check('operationInfo.skipSucceededOnRetry', True), - self.check('status', 'Canceling')]) - - while True: - self.sleep(120) - failed_rollout = self.cmd('deploymentmanager rollout show -g {rg} -n {failed_rollout_name}').get_output_in_json() - if (failed_rollout['status'] != 'Canceling'): - break - - self.cmd('deploymentmanager rollout delete -g {rg} -n {failed_rollout_name}') - self.cmd('deploymentmanager rollout delete -g {rg} -n {rollout_name}') - - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager rollout show -g {rg} -n {failed_rollout_name}') - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager rollout show -g {rg} -n {rollout_name}') - - def set_managed_identity(self, subscription_id, resource_group_name): - - is_playback = os.path.exists(self.recording_file) - if not is_playback: - identity_name = resource_group_name + "Identity" - self.kwargs = { - 'rg': resource_group_name, - 'name': identity_name, - } - identity = self.cmd('identity create -n {name} -g {rg}').get_output_in_json() - identityId = identity['id'] - - self.sleep(120) - - self.kwargs = { - 'rg': resource_group_name, - 'principalId': identity['principalId'], - 'role': "Contributor", - 'scope': "/subscriptions/{0}".format(subscription_id), - } - - self.cmd('role assignment create --assignee {principalId} --role {role} --scope {scope}') - - self.sleep(30) - - self.replace_string("__USER_ASSIGNED_IDENTITY__", identityId, create_rollout_template) - self.replace_string("__USER_ASSIGNED_IDENTITY__", identityId, failure_create_rollout_template) - - return identityId - - return "dummyid" - - def new_artifact_source( - self, - resource_group_name, - storage_account_name, - artifact_source_name, - location, - setup_container): - - artifact_root = "artifactroot" - container_name = "artifacts" - - sas_uri = self.get_sas_for_artifacts_container( - resource_group_name, - storage_account_name, - container_name, - artifact_root, - setup_container) - - self.kwargs = { - 'rg': resource_group_name, - 'location': location, - 'as_name': artifact_source_name, - 'sas': sas_uri, - 'artifactroot': artifact_root - } - - self.cmd('deploymentmanager artifact-source create -g {rg} -n {as_name} -l \"{location}\" --sas-uri \"{sas}\" --artifact-root {artifactroot}', checks=[ - self.check('type', 'Microsoft.DeploymentManager/artifactSources'), - self.check('artifactRoot', artifact_root), - self.check('name', artifact_source_name) - ]) - - return self.cmd('deploymentmanager artifact-source show -g {rg} -n {as_name}').get_output_in_json()['id'] - - def get_sas_for_artifacts_container( - self, - resource_group_name, - storage_account_name, - storage_container_name, - artifact_root, - setup_container): - - is_playback = os.path.exists(self.recording_file) - if not is_playback: - if setup_container: - self.setup_artifacts_container(resource_group_name, storage_account_name, storage_container_name) - - return self.create_sas_key_for_container(storage_account_name, storage_container_name) - - return "dummysasforcontainer" - - def create_sas_key_for_container(self, storage_account_name, container_name): - from datetime import datetime, timedelta - start = (datetime.utcnow() + timedelta(hours=-1)).strftime('%Y-%m-%dT%H:%MZ') - expiry = (datetime.utcnow() + timedelta(hours=10)).strftime('%Y-%m-%dT%H:%MZ') - self.kwargs = { - 'account': storage_account_name, - 'container': container_name, - 'expiry': expiry, - 'start': start - } - - sas = self.cmd('storage container generate-sas -n {container} --account-name {account} ' - '--permissions rl --start {start} --expiry {expiry} -otsv').output.strip() - - full_uri = "https://" + storage_account_name + ".blob.core.windows.net/" + container_name + "?" + sas - return full_uri - - def setup_artifacts_container(self, resource_group_name, storage_account_name, container_name): - stgAcctForTemplate = resource_group_name + "stgtemplate" - storageAcountReplacementSymbol = "__STORAGEACCOUNTNAME__" - - self.replace_string(storageAcountReplacementSymbol, stgAcctForTemplate, parametersArtifactSourceRelativePath) - self.replace_string(storageAcountReplacementSymbol, stgAcctForTemplate, parametersCopyArtifactSourceRelativePath) - - storage_account_info = self.get_stg_account_info(resource_group_name, storage_account_name) - self.create_container(storage_account_info, container_name) - - self.upload_blob(storage_account_info, container_name, parametersArtifactSourceRelativePath, parameters_file_name) - self.upload_blob(storage_account_info, container_name, parametersCopyArtifactSourceRelativePath, params_copy_file_name) - self.upload_blob(storage_account_info, container_name, templateArtifactSourceRelativePath, template_file_name) - self.upload_blob(storage_account_info, container_name, templateCopyArtifactSourceRelativePath, template_copy_file_name) - self.upload_blob(storage_account_info, container_name, invalidParametersArtifactSourceRelativePath, invalid_parameters_file_name) - - def list_steps(self, resource_group_name, step_name): - self.kwargs = { - 'rg': resource_group_name, - 'step_name': step_name - } - - steps = self.cmd('deploymentmanager step list -g {rg}', checks=[ - self.check("length(@)", 3) - ]).get_output_in_json() - - selected_step = [x for x in steps if(x['name'].lower() == step_name.lower())] - self.assertIsNotNone(selected_step, "list steps did not return {step_name}.") - - def list_service_units(self, resource_group_name, service_topology_name, service_name, service_unit_name): - self.kwargs = { - 'rg': resource_group_name, - 'st_name': service_topology_name, - 's_name': service_name, - 'su_name': service_unit_name - } - - service_units = self.cmd('deploymentmanager service-unit list -g {rg} --service-topology-name {st_name} --service-name {s_name}', checks=[ - self.check("length(@)", 2) - ]).get_output_in_json() - - selected_service_unit = [x for x in service_units if(x['name'].lower() == service_unit_name.lower())] - self.assertIsNotNone(selected_service_unit, "list service units did not return {su_name}.") - - def list_services(self, resource_group_name, service_topology_name, service_name): - self.kwargs = { - 'rg': resource_group_name, - 'st_name': service_topology_name - } - - services = self.cmd('deploymentmanager service list -g {rg} --service-topology-name {st_name}', checks=[ - self.check("length(@)", 2) - ]).get_output_in_json() - - self.kwargs = { - 's_name': service_name - } - - selected_service = [x for x in services if(x['name'].lower() == service_name.lower())] - self.assertIsNotNone(selected_service, "list services did not return {s_name}.") - - def list_service_topologies(self, resource_group_name, service_topology_name): - self.kwargs = { - 'rg': resource_group_name - } - - service_topologies = self.cmd('deploymentmanager service-topology list -g {rg}', checks=[ - self.check("length(@)", 2) - ]).get_output_in_json() - - self.kwargs = { - 'st_name': service_topology_name - } - - selected_service_topology = [x for x in service_topologies if(x['name'].lower() == service_topology_name.lower())] - self.assertIsNotNone(selected_service_topology, "list service topologies did not return {st_name}.") - - def list_artifact_sources(self, resource_group_name, artifact_source_name): - self.kwargs = { - 'rg': resource_group_name - } - - artifact_sources = self.cmd('deploymentmanager artifact-source list -g {rg}', checks=[ - self.check("length(@)", 2) - ]).get_output_in_json() - - self.kwargs = { - 'as_name': artifact_source_name - } - - selected_artifact_source = [x for x in artifact_sources if(x['name'].lower() == artifact_source_name.lower())] - self.assertIsNotNone(selected_artifact_source, "list artifact sources did not return {as_name}.") - - def delete_artifact_source(self, resource_group_name, artifact_source_name): - self.kwargs = { - 'rg': resource_group_name, - 'name': artifact_source_name, - } - self.cmd('deploymentmanager artifact-source delete -n {name} -g {rg} --yes') - - with self.assertRaisesRegex(SystemExit, '3'): - self.cmd('deploymentmanager artifact-source show -n {name} -g {rg}') - - def upload_blob(self, storage_account_info, storage_container_name, file_path, file_name): - abs_file_path = os.path.join(TEST_DIR, file_path).replace('\\', '\\\\') - blob_path = artifact_root + "/" + file_name - self.storage_cmd('storage blob upload -c {} -n {} -f "{}" -t block', storage_account_info, - storage_container_name, blob_path, abs_file_path) - - def get_stg_account_key(self, group, name): - - template = 'storage account keys list -n {} -g {} --query "[0].value" -otsv' - return self.cmd(template.format(name, group)).output - - def get_stg_account_info(self, group, name): - """Returns the storage account name and key in a tuple""" - return name, self.get_stg_account_key(group, name) - - def create_container(self, account_info, container_name): - self.storage_cmd('storage container create -n {}', account_info, container_name) - return container_name - - def storage_cmd(self, cmd, account_info, *args): - cmd = cmd.format(*args) - cmd = '{} --account-name {} --account-key {}'.format(cmd, *account_info) - return self.cmd(cmd) - - def replace_string(self, replacement_symbol, replacement_value, filePath, overridePlayback=False): - is_playback = os.path.exists(self.recording_file) - if (not is_playback or overridePlayback): - file = fileinput.FileInput(filePath, inplace=True) - for line in file: - print(line.replace(replacement_symbol, replacement_value), end='') - file.close() - - def replace_rollout_placeholders( - self, - rollout_name, - target_service_topology_id, - artifact_source_id, - step_id, - service_unit_id, - file_path - ): - is_playback = os.path.exists(self.recording_file) - if not is_playback: - self.replace_string("__ROLLOUT_NAME__", rollout_name, file_path) - self.replace_string("__TARGET_SERVICE_TOPOLOGY__", target_service_topology_id, file_path) - self.replace_string("__ARTIFACT_SOURCE_ID__", artifact_source_id, file_path) - self.replace_string("__STEP_ID__", step_id, file_path) - self.replace_string("__SERVICE_UNIT_ID__", service_unit_id, file_path) - - def sleep(self, duration): - is_playback = os.path.exists(self.recording_file) - if not is_playback: - time.sleep(duration) diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index 10bf330c1d3..fef8e87e5a0 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -40,7 +40,6 @@ azure-mgmt-datalake-analytics==0.2.1 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.5.0 azure-mgmt-datamigration==10.0.0 -azure-mgmt-deploymentmanager==0.2.0 azure-mgmt-devtestlabs==4.0.0 azure-mgmt-dns==8.0.0 azure-mgmt-eventgrid==10.2.0b2 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index f9d52cd209a..014dcde6af8 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -40,7 +40,6 @@ azure-mgmt-datalake-analytics==0.2.1 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.5.0 azure-mgmt-datamigration==10.0.0 -azure-mgmt-deploymentmanager==0.2.0 azure-mgmt-devtestlabs==4.0.0 azure-mgmt-dns==8.0.0 azure-mgmt-eventgrid==10.2.0b2 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index ea6a4249d18..884d8418200 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -40,7 +40,6 @@ azure-mgmt-datalake-analytics==0.2.1 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==0.5.0 azure-mgmt-datamigration==10.0.0 -azure-mgmt-deploymentmanager==0.2.0 azure-mgmt-devtestlabs==4.0.0 azure-mgmt-dns==8.0.0 azure-mgmt-eventgrid==10.2.0b2 diff --git a/src/azure-cli/service_name.json b/src/azure-cli/service_name.json index 91f488bbfb4..e08434f4fc2 100644 --- a/src/azure-cli/service_name.json +++ b/src/azure-cli/service_name.json @@ -174,11 +174,6 @@ "AzureServiceName": "Azure Resource Manager", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/template-tutorial-deployment-script" }, - { - "Command": "az deploymentmanager", - "AzureServiceName": "Azure Resource Manager", - "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/deployment-manager-overview" - }, { "Command": "az devops", "AzureServiceName": "Azure DevOps", diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index 057da204b4b..258d15ea205 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -83,7 +83,6 @@ 'azure-mgmt-datalake-analytics~=0.2.1', 'azure-mgmt-datalake-store~=0.5.0', 'azure-mgmt-datamigration~=10.0.0', - 'azure-mgmt-deploymentmanager~=0.2.0', 'azure-mgmt-devtestlabs~=4.0', 'azure-mgmt-dns~=8.0.0', 'azure-mgmt-eventgrid==10.2.0b2',