From 5ee972a2e0dc37cb7b3a869c635454daec1981fe Mon Sep 17 00:00:00 2001 From: jeffj6123 Date: Fri, 20 Jul 2018 14:41:02 -0400 Subject: [PATCH] Mesh preview rc (#29) * Remove rdbms public CLI extension. (#179) * Worm feature and listing usage by region (#181) * vendored mgmt sdk * sdk * updated old recordings for new sdk * added worm feature enable listing usage by region ci fixes fixes fixes flake8 fixes removed prints * address feedback * updated index with new extension path * version bump in index * Updating the dev-spaces command from aks group to ads group (#183) * Updating the dev-spaces command from aks group to ads group - refactoring * Installing cli tooling, if does not exist, on remove command * Updating min req of azure cli to 2.0.32 * Reverting index related changes - will send out a separate PR for this, after updating the generated whl file. * Updating index: sha and minCliVersion (#185) * iotext v0.4.5 (#188) * iotext v0.4.5 * Fix sha256 hash. * Bumping Dev Spaces version to 0.1.1 and updating the Index (#186) * VNET extension (#176) * VNET extension Adding VNET extension for public repo , Pending changes : update index.json to add the extension and uploading .whl file to blob repo will happen later . * fixing indentation fixing indentation * fixing more flake8 reported issues fixing more flake8 reported issues * Fixing Review comments and formatting issues. Fixing Review comments and formatting issues. * Fixing some more issues with source static and bug fixes Fixing some more issues with source static and bug fixes * Renaming _client_factory to _client_vnet_factory Renaming _client_factory to _client_vnet_factory * Reverting the last change Reverting the last change * Renaming to azext_rdbms_vnet Renaming to azext_rdbms_vnet * More formatting issue fix More formatting issue fix * adding code owners adding code owners * Adding my email id Adding my email id :) * Adding extension to index.json wheel file is already uploaded to prodrdbmsclipackages * fixing index-verify fixing index-verify * Changed the default value for eventdeliveryschema parameter to match the input event schema. (#189) * Added eventgrid preview extension to index.json. * Made the hash lowercase. * Regenerated using Wheel 0.30 * Updating index metadata to match with what's in the package. * Updated the description to match what's in the package. * Added minCliCoreVersion in index.json to match with the metadata in the package. * Changed the default value for eventdeliveryschema parameter to match the input event schema. * Updated version in index.json and fixed the default in the function argument list. * Changing SHA256digest to lower case. * Regenerated extension with 0.30.0 of wheel to resolve CI errors. * Updating space select functionality (#191) * Updating space select - selecting space on resource create/select both - updating azds osx url * Update * CR * Adding comments * CR * Management policy and new api-version (#194) * added new apiversion for mgmt sdk * updated storage mgmt client for new api * updated sdk and most recordings except show usage * finalized commands * usage to usages and help * fixed excryption tests * static check * updated help * Management policy recording and new version of wheel (#195) * updated some recordings * added new wheel to index * project url * updated whl * update index.json with new botservice package(minor fixes) (#199) * update index.json with new botservice package(minor fixes) * update version on index.json to match the new package * Updating dev-spaces-preview extension to honor azds commands update (#196) * Updating dev-spaces-preview extension to honor azds commands update * Adding update option to force install the newer version of azds tool * Update remove command * Index Update * Image-Copy: add support for sources backup by vhd files and snapshots (#201) * update descriptions and version * Add checks to verify that the source has a managed disk * fix procedure to name the temp storage account * support tags and final image name * fix lint issue * remove debug statement * add version 0.0.6 to index * support sources backed by vhd blobs (copied images) and snapshots * fix how we find the source_os_disk_id * adding image-copy version 0.0.7 to the index * fix issue with publishing to bot (#202) * fix missing client error during publish * update index.json * remove unused client variable * Updating some params of use command (#200) * Updating some params of use command * Updating index and bumping version * Removing commands and just keeping the module library to be accessed by azure cli * Index update * disable=too-few-public-methods * extend alotted time for script in travis (#208) * extend alotted time for script in travis * longer CI times for surcetests * Updates to extension documentation (#210) * doc for vendored_sdks folder * add README to point at extension docs in azure-cli folder * forgot to add docs readme * DMS - Adding PG and MySQL extension (#207) * Added functionality for Data Migration Assistant * Renamed extension * Updated the default database for PG * Updated the extension description to remove any CLI references * Renamed 'mgmt' to 'vendored_sdks' * Fixed pylint issues * extend alotted time for script in travis * Fixed flake8 test results * Updated code owners * Added metadata * Added license headers * added information to storage-preview extension readme for included features (#212) * Updating az use call to azds cli (#211) * Updating az use call to azds cli - addressing azds updated cli * Fix indentation error * update * Update * CR: renaming the prompt variable * readme changes (#214) * Updating output messages to be printed in default mode (#215) * Updating output messages to be printed in default mode * Code Review Update * increase travis wait time for source tests * Add support for oauth connection management in botservice (#213) * add support for oauth to botservice cli * minor fixes * fix style warnings * more pylint error fixes * fix flake errors * addressed comments. bumped up version * Static web and hierarchical namespace features. (#218) * updated sdk * service-properties update * initial generic update for blob service-properties * implemented generic update for service props * added testing and recording update * fixed bug * added test * recording * updated mgmt sdk for storage * added hierarchical namespace feature to account create * version bump * ci * pylint and re-recorded all tests * updated all recordings and tests for new sdks * IoT extension release 0.5.0 (#219) * IoT extension release 0.5.0 * fix dep format issue * change order of index dependencies * Index storage 0.1.3 (#220) * index storage * index edits * added examples and new features (#221) * updated api-version of arm to cli (#222) * updated api-version of arm to cli * converted all api-versions for resource * Update batch extension to 2.3.0 (#225) * changes to dependency check (#226) * changes to dependency check * CI * Fixed: can not connect when using slot option. (#227) * improved the deployment create command to now display back the public IP Addresses of the applications if available otherwise the status of the applications within the tempalte * added warning for when a network for an application can not be reached * added in displaying arm deployment errors * removed ~ folder * fixed the imports from client factory * removing files * specified errors and reduced clutter and depth of if statements * removed .vs * put in ascii friendly character * docs (#228) * added better logic handling for errors and show running now * fixed import for http error from network client * changed setup.py to 0.9.0 and changed the deploying to not redisplay * removed the untested parts * fixed white space comma issue * updated version * added history.rst version * improved wording of history.rst * added more safety checks for getting network references. reduced duplicate checks for looping over applications. fixed outputting for a few different places * Automationstatic (#232) * use flake8 config to apply exclusions, remove travis wait * pin pylint 1.9.2 for CI * fix link for extension summary for PRs (#233) * Checks for license presence while disregarding '#\n' (#237) * license ignore newlines * added licenses * cleanup * add static check as precheck (#238) * add static check as precheck * made basic index verification part of precheck * added network ref parse ability for other common format * started adding validation precheck to deploying * now has validation error check first * changed len check of string * cleaned up output * fixed formatting * fixed formatting of EOF lines * removed logging statement * removed the no wait from validation because it didnt seem necessary * ref doc gen broken due to deprecation work (#240) * should now just return expressions from the function and removed unused import * removed .idea files * should fix the inconsistent return formatting issue * added back missing new line * check_call will block child_process if enough output is sent to PIPE (#243) * check_call will block child_process if enough output is sent to PIPE * run is unavailable in python2, opting for check_output which reads from the PIPE * remove PIPE * fixed client naming --- .flake8 | 13 ++ .github/PULL_REQUEST_TEMPLATE.md | 2 +- .travis.yml | 18 +-- scripts/ci/test_source.py | 5 +- scripts/ci/test_static.sh | 4 +- scripts/ci/verify_license.py | 21 +-- scripts/refdoc/azhelpgen/azhelpgen.py | 10 +- scripts/refdoc/cligroup/cligroup.py | 26 ++-- src/mesh/HISTORY.rst | 7 + src/mesh/azext_mesh/custom.py | 135 +++++++++++++++++- .../mgmt/servicefabricmesh/__init__.py | 1 - .../mgmt/servicefabricmesh/version.py | 1 - src/mesh/setup.py | 2 +- src/storage-preview/README.md | 10 +- .../vendored_sdks/__init__.py | 5 + .../vendored_sdks/azure_storage/__init__.py | 5 + .../azure_storage/v2018_03_28/__init__.py | 5 +- 17 files changed, 212 insertions(+), 58 deletions(-) diff --git a/.flake8 b/.flake8 index 283ad44ac5e..95ca2105a17 100644 --- a/.flake8 +++ b/.flake8 @@ -7,3 +7,16 @@ ignore = F401, # imported but unused, too many violations, to be removed in the future F811, # redefinition of unused, to be removed in the future C901 # code flow is too complex, too many violations, to be removed in the future +exclude = + */vendored_sdks + docs + scripts + ./src/eventgrid/azext_eventgrid/mgmt/eventgrid + ./src/botservice/azext_bot/botservice + ./src/dns/azext_dns/dns + ./src/managementgroups/azext_managementgroups/managementgroups + ./src/managementpartner/azext_managementpartner/managementpartner + ./src/rdbms_vnet/azext_rdbms_vnet/postgresql + ./src/rdbms_vnet/azext_rdbms_vnet/mysql + ./src/signalr/azext_signalr/signalr + ./src/subscription/azext_subscription/subscription \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5ded3686526..823593378b8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,4 +9,4 @@ This checklist is used to make sure that common guidelines for a pull request ar For new extensions: -- [ ] My extension description/summary conforms to the [Extension Summary Guidelines](https://github.com/Azure/azure-cli-extensions/blob/master/docs/extension_summary_guidelines.md). +- [ ] My extension description/summary conforms to the [Extension Summary Guidelines](https://github.com/Azure/azure-cli/blob/dev/doc/extensions/extension_summary_guidelines.md). diff --git a/.travis.yml b/.travis.yml index e54337287b5..93a017c66a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,16 +4,20 @@ language: python services: - docker install: - - pip install pylint flake8 requests wheel==0.30.0 -q + - pip install pylint==1.9.2 flake8 requests wheel==0.30.0 -q jobs: include: - - stage: verify + - stage: precheck env: PURPOSE='SourceStatic' - script: travis_wait ./scripts/ci/test_static.sh + script: ./scripts/ci/test_static.sh python: 2.7 - - stage: verify + - stage: precheck env: PURPOSE='SourceStatic' - script: travis_wait ./scripts/ci/test_static.sh + script: ./scripts/ci/test_static.sh + python: 3.6 + - stage: precheck + env: PURPOSE='IndexVerify' + script: python ./scripts/ci/test_index.py -v python: 3.6 - stage: verify env: PURPOSE='SourceTests' @@ -23,10 +27,6 @@ jobs: env: PURPOSE='SourceTests' script: travis_wait 40 ./scripts/ci/test_source.sh python: 3.6 - - stage: verify - env: PURPOSE='IndexVerify' - script: python ./scripts/ci/test_index.py -v - python: 3.6 - stage: verify env: PURPOSE='IndexRefDocVerify' script: ./scripts/ci/test_index_ref_doc.sh diff --git a/scripts/ci/test_source.py b/scripts/ci/test_source.py index f89af572f11..d4e4fb9db56 100755 --- a/scripts/ci/test_source.py +++ b/scripts/ci/test_source.py @@ -12,7 +12,7 @@ import tempfile import unittest import shutil -from subprocess import check_call, CalledProcessError, PIPE +from subprocess import check_output, check_call, CalledProcessError import mock from wheel.install import WHEEL_INFO_RE @@ -76,8 +76,7 @@ def test_source_wheels(self): if not os.path.isfile(os.path.join(s, 'setup.py')): continue try: - check_call(['python', 'setup.py', 'bdist_wheel', '-q', '-d', built_whl_dir], - cwd=s, stdout=PIPE, stderr=PIPE) + check_output(['python', 'setup.py', 'bdist_wheel', '-q', '-d', built_whl_dir], cwd=s) except CalledProcessError as err: self.fail("Unable to build extension {} : {}".format(s, err)) for filename in os.listdir(built_whl_dir): diff --git a/scripts/ci/test_static.sh b/scripts/ci/test_static.sh index e83ecd9a1e0..606ca66c26a 100755 --- a/scripts/ci/test_static.sh +++ b/scripts/ci/test_static.sh @@ -14,7 +14,7 @@ pylint ./src/*/azext_*/ --ignore=$PYLINT_EXCLUDES,vendored_sdks --ignore-pattern echo "Pylint OK." echo "Running flake8 on extensions..." -flake8 --statistics --exclude=$FLAKE8_EXCLUDES,vendored_sdks --append-config=./.flake8 ./src/*/azext_*/ +flake8 --statistics --append-config=./.flake8 ./src/*/azext_*/ echo "Flake8 OK." # Run pylint/flake8 on CI files @@ -23,4 +23,4 @@ flake8 --append-config=./.flake8 ./scripts/ci/*.py # Other static checks python ./scripts/ci/verify_codeowners.py -python ./scripts/ci/verify_license.py 'src/storage-preview/azext_storage_preview/vendored_sdks' +python ./scripts/ci/verify_license.py diff --git a/scripts/ci/verify_license.py b/scripts/ci/verify_license.py index 65bbab7b130..363f80584a7 100644 --- a/scripts/ci/verify_license.py +++ b/scripts/ci/verify_license.py @@ -14,22 +14,8 @@ REPO_ROOT = get_repo_root() SRC_DIR = os.path.join(REPO_ROOT, 'src') -LICENSE_HEADER = """# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -""" - -AUTOREST_LICENSE_HEADER = """# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -""" +LICENSE_HEADER = ("Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. " + "See License.txt in the project root for license information.") def main(args): @@ -45,7 +31,8 @@ def main(args): for python_file in file_itr: with open(python_file, 'r') as f: file_text = f.read().replace('\r\n', '\n') - if file_text and (LICENSE_HEADER not in file_text and AUTOREST_LICENSE_HEADER not in file_text): + file_text = file_text.replace('\n#', '') + if file_text and (LICENSE_HEADER not in file_text): files_without_header.append(os.path.join(current_dir, python_file)) if files_without_header: diff --git a/scripts/refdoc/azhelpgen/azhelpgen.py b/scripts/refdoc/azhelpgen/azhelpgen.py index 80e47ee8fdd..93cb0e95015 100644 --- a/scripts/refdoc/azhelpgen/azhelpgen.py +++ b/scripts/refdoc/azhelpgen/azhelpgen.py @@ -33,7 +33,7 @@ def get_extension_help_files(cli_ctx): print('FOUND {} command(s) from the extension.'.format(len(cmd_table))) for cmd_name in cmd_table: invoker.commands_loader.load_arguments(cmd_name) - invoker.parser.load_command_table(invoker.commands_loader.command_table) + invoker.parser.load_command_table(invoker.commands_loader) parser_keys = [] parser_values = [] @@ -44,10 +44,12 @@ def get_extension_help_files(cli_ctx): if cmd not in sub_parser_keys: sub_parser_keys.append(cmd) sub_parser_values.append(parser) + help_ctx = cli_ctx.help_cls(cli_ctx=cli_ctx) help_files = [] for cmd, parser in zip(sub_parser_keys, sub_parser_values): try: - help_file = GroupHelpFile(cmd, parser) if _is_group(parser) else CliCommandHelpFile(cmd, parser) + help_file = GroupHelpFile(help_ctx, cmd, parser) if _is_group(parser) \ + else CliCommandHelpFile(help_ctx, cmd, parser) help_file.load(parser) help_files.append(help_file) except Exception as ex: @@ -73,6 +75,8 @@ def make_rst(self): yield '' yield '{}:summary: {}'.format(INDENT, help_file.short_summary) yield '{}:description: {}'.format(INDENT, help_file.long_summary) + if help_file.deprecate_info: + yield '{}:deprecated: {}'.format(INDENT, help_file.deprecate_info._get_message(help_file.deprecate_info)) yield '' if is_command and help_file.parameters: @@ -84,6 +88,8 @@ def make_rst(self): yield '{}.. cliarg:: {}'.format(INDENT, arg.name) yield '' yield '{}:required: {}'.format(DOUBLEINDENT, arg.required) + if arg.deprecate_info: + yield '{}:deprecated: {}'.format(DOUBLEINDENT, arg.deprecate_info._get_message(arg.deprecate_info)) short_summary = arg.short_summary or '' possible_values_index = short_summary.find(' Possible values include') short_summary = short_summary[0:possible_values_index diff --git a/scripts/refdoc/cligroup/cligroup.py b/scripts/refdoc/cligroup/cligroup.py index ed6ecfc8955..49d5450f5bc 100644 --- a/scripts/refdoc/cligroup/cligroup.py +++ b/scripts/refdoc/cligroup/cligroup.py @@ -32,29 +32,35 @@ def get_index_text(self, modname, name): class CliGroupDirective(CliBaseDirective): doc_field_types = copy.copy(cli_field_types) - doc_field_types.append( + doc_field_types.extend([ Field('docsource', label='Doc Source', has_arg=False, - names=('docsource', 'documentsource')) - ) + names=('docsource', 'documentsource')), + Field('deprecated', label='Deprecated', has_arg=False, + names=('deprecated')) + ]) class CliCommandDirective(CliBaseDirective): doc_field_types = copy.copy(cli_field_types) - doc_field_types.append( + doc_field_types.extend([ Field('docsource', label='Doc Source', has_arg=False, - names=('docsource', 'documentsource')) - ) + names=('docsource', 'documentsource')), + Field('deprecated', label='Deprecated', has_arg=False, + names=('deprecated')) + ]) class CliArgumentDirective(CliBaseDirective): doc_field_types = copy.copy(cli_field_types) doc_field_types.extend([ Field('required', label='Required', has_arg=False, - names=('required')), + names=('required')), Field('values', label='Allowed values', has_arg=False, - names=('values', 'choices', 'options')), + names=('values', 'choices', 'options')), Field('default', label='Default value', has_arg=False, - names=('default')), + names=('default')), Field('source', label='Values from', has_arg=False, - names=('source', 'sources')) + names=('source', 'sources')), + Field('deprecated', label='Deprecated', has_arg=False, + names=('deprecated')) ]) class CliExampleDirective(CliBaseDirective): diff --git a/src/mesh/HISTORY.rst b/src/mesh/HISTORY.rst index d2446792b93..29ca537bc34 100644 --- a/src/mesh/HISTORY.rst +++ b/src/mesh/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== + +0.9.0 (2018-07-16) +++++++++++++++++++ + +* Added diagnostic output to deployment create command. + + 0.8.0 (2018-07-09) ++++++++++++++++++ diff --git a/src/mesh/azext_mesh/custom.py b/src/mesh/azext_mesh/custom.py index 2a4914d85fc..e8be7706a26 100644 --- a/src/mesh/azext_mesh/custom.py +++ b/src/mesh/azext_mesh/custom.py @@ -11,6 +11,7 @@ import ssl import sys import os +from time import sleep from six.moves.urllib.request import urlopen # pylint: disable=import-error from knack.log import get_logger @@ -21,6 +22,8 @@ from azure.cli.core.commands.client_factory import get_mgmt_service_client from azure.cli.core.profiles import ResourceType, get_sdk +from azext_mesh._client_factory import cf_mesh_network, cf_mesh_application, cf_mesh_deployments +from azext_mesh.servicefabricmesh.mgmt.servicefabricmesh.models import ErrorModelException logger = get_logger(__name__) @@ -216,6 +219,109 @@ def _get_missing_parameters(parameters, template, prompt_fn): return parameters +def _parse_network_ref(network_ref_name): + # assume format of /subscriptions/subscriptionID/resourcegroups/resourcegroupname/providers/Microsoft.ServiceFabricMesh/networks/networkname + resource_parts = network_ref_name.split('/') + return resource_parts[-1] + + +def _display_successful_application(cfn, resource_group_name, resource): + application_name = resource['name'] + services = resource['properties']['services'] + network_resource_information = None + network_name = None + + if services: + + for service in services: + if service['properties']['networkRefs']: + for network_ref in service['properties']['networkRefs']: + network_name = _parse_network_ref(network_ref['name']) + if network_name: + break + + if network_name: + try: + network_resource_information = cfn.get(resource_group_name, network_name) + except ErrorModelException: + logger.warning("{application} network resource {network_name} can not be found." + .format(application=application_name, network_name=network_name)) + + if network_resource_information and network_resource_information.ingress_config: + public_ip_address = network_resource_information.ingress_config.public_ip_address + logger.warning("application {application} has been deployed successfully on network {network} with public ip address {ip}" + .format(application=application_name, network=network_name, ip=public_ip_address)) + else: + logger.warning("application {application} has been deployed successfully".format(application=application_name)) + + +def _display_application_status(mesh_network_client, resource, resource_group_name, mesh_application_client): + + application_name = resource['name'] + try: + application_operation_information = mesh_application_client.get(resource_group_name, application_name) + application_status = application_operation_information.provisioning_state + if application_status in ['Succeeded']: + _display_successful_application(mesh_network_client, resource_group_name, resource) + elif application_status in ['Failed']: + status_details = application_operation_information.status_details + if status_details: + logger.warning("application {application} deployment failed with {status_details}" + .format(application=application_name, status_details=status_details)) + else: + logger.warning("application {application} deployment failed".format(application=application_name)) + else: + logger.warning("application {application} deployment not complete with status {status}" + .format(application=application_name, status=application_status)) + except ErrorModelException: + logger.warning("There was an error when getting application resource {0}." + .format(application_name)) + + +def _display_deployment_status(cli_ctx, operation_status, resource_group_name, deployment_name, template_obj): + mesh_deployment_client = cf_mesh_deployments(cli_ctx, '') + mesh_network_client = cf_mesh_network(cli_ctx, '') + + deployment_status = mesh_deployment_client.get(resource_group_name, deployment_name) + + if operation_status in ['Failed']: + logger.warning("Deployment failed") + logger.warning("deployment correlation ID: {deployment_correlation_id}" + .format(deployment_correlation_id=deployment_status.properties.correlation_id)) + + application_count = 0 + only_application_name = None + mesh_application_client = cf_mesh_application(cli_ctx, '') + for resource in template_obj: + if resource['type'] in ['Microsoft.ServiceFabricMesh/applications']: + _display_application_status(mesh_network_client, resource, resource_group_name, mesh_application_client) + only_application_name = resource['name'] + application_count += 1 + + if application_count is 1: + logger.warning( + "To recieve additional information run the following to get the status of the application deployment.") + logger.warning("az mesh app show --resource-group {resource_group_name} --name {application_name}" + .format(resource_group_name=resource_group_name, application_name=only_application_name)) + elif application_count > 1: + logger.warning( + "To recieve additional information run the following to get the status of the application's deployments") + logger.warning("az mesh app list --resource-group {resource_group_name}" + .format(resource_group_name=resource_group_name)) + + if 'error' in deployment_status.properties.additional_properties: + logger.warning("Deployment Errors: ") + for error in deployment_status.properties.additional_properties['error']['details']: + # load error message into object to parse + error_message = json.loads(error['message']) + if 'innerError' in error_message['error']: + del error_message['error']['innerError'] + logger.warning(json.dumps(error_message['error'], indent=4, sort_keys=True)) + + if operation_status in ['Running']: + logger.warning("The output should point to the potential issue. If the above cmd response does not have any errors listed, then it could just be that your image is taking long to download, rerun the above command again after 5 minutes.") + + def _deploy_arm_template_core(cli_ctx, resource_group_name, # pylint: disable=too-many-arguments template_file=None, template_uri=None, deployment_name=None, parameters=None, mode=None, validate_only=False, @@ -244,19 +350,38 @@ def _deploy_arm_template_core(cli_ctx, resource_group_name, # pylint: disable=t parameters=parameters, mode=mode) # workaround properties.mode = 'incremental' - smc = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES) + if validate_only: return sdk_no_wait(no_wait, smc.deployments.validate, resource_group_name, deployment_name, properties) - return sdk_no_wait(no_wait, smc.deployments.create_or_update, resource_group_name, deployment_name, properties) + + validation = smc.deployments.validate(resource_group_name, deployment_name, properties) + + if validation.error: + logger.warning("deployment template validation failed:") + logger.warning(validation.error) + else: + operation_status_poller = sdk_no_wait(no_wait, smc.deployments.create_or_update, resource_group_name, + deployment_name, properties) + if no_wait: + return operation_status_poller + + wait_time = 0 + timestep = 5 + while operation_status_poller.status() in ['Running', 'InProgress'] and wait_time < 600: + sleep(timestep) + wait_time += timestep + + parsed_template = smc.deployments.validate(resource_group_name, deployment_name, properties).properties.additional_properties['validatedResources'] + + return _display_deployment_status(cli_ctx, operation_status_poller.status(), resource_group_name, + deployment_name, parsed_template) def deploy_arm_template(cmd, resource_group_name, template_file=None, template_uri=None, deployment_name=None, parameters=None, mode=None, no_wait=False): - print("If the deployment takes more than 10 minutes, then open up a new CLI window and run the following to get the status of your application deployment.") - print("az mesh app show --resource-group --name ") - print("The output should point to the potential issue. If the 'app show' cmd response does not have any errors listed, then it could just be that your image is taking long to download, rerun the az mesh app show command again after 5 minutes.") + logger.warning("Deploying . . .") return _deploy_arm_template_core(cmd.cli_ctx, resource_group_name, template_file, template_uri, deployment_name, parameters, mode, no_wait=no_wait) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/__init__.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/__init__.py index 667f9632953..5f8ad00a7d6 100644 --- a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/__init__.py +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/__init__.py @@ -15,4 +15,3 @@ __all__ = ['ServiceFabricMeshManagementClient'] __version__ = VERSION - diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/version.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/version.py index 640f86d33a0..0442112a915 100644 --- a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/version.py +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/version.py @@ -10,4 +10,3 @@ # -------------------------------------------------------------------------- VERSION = "2018-07-01-preview" - diff --git a/src/mesh/setup.py b/src/mesh/setup.py index 55796518cb8..29169812c44 100644 --- a/src/mesh/setup.py +++ b/src/mesh/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.8.0" +VERSION = "0.9.0" CLASSIFIERS = [ 'Development Status :: 4 - Beta', diff --git a/src/storage-preview/README.md b/src/storage-preview/README.md index b9fb48ac4d4..2bf1bc129e9 100644 --- a/src/storage-preview/README.md +++ b/src/storage-preview/README.md @@ -9,7 +9,7 @@ az extension add --name storage-preview ### Included Features **OAuth:** -Allow use of login credentials for authorization of storage operations: [more info](https://docs.microsoft.com/en-us/rest/api/storageservices/authenticate-with-azure-active-directory) +Allow use of login credentials for authorization of storage operations: [more info](https://docs.microsoft.com/en-us/rest/api/storageservices/authenticate-with-azure-active-directory)\ *Examples:* ``` az storage container list \ @@ -18,7 +18,7 @@ az storage container list \ ``` **Immutable Storage-WORM(Write-Once-Read-Many):** -Manage immutability storage with Azure blobs: [more info](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-immutable-storage) +Manage immutability storage with Azure blobs: [more info](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-immutable-storage)\ *Examples:* ``` az storage container immutability-policy create \ @@ -39,7 +39,7 @@ az storage container legal-hold set \ ``` **Management Policy:** -Manage data policy rules associated with a storage account: [more info](https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts) +Manage data policy rules associated with a storage account: [more info](https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts)\ *Examples:* ``` az storage account management-policy create \ @@ -49,7 +49,7 @@ az storage account management-policy create \ ``` **Static Website:** -Manage static website configurations. +Manage static website configurations.\ *Examples:* ``` az storage blob service-properties update \ @@ -60,7 +60,7 @@ az storage blob service-properties update \ ``` **Hierarchical Namespace:** -Enable the blob service to exhibit filesystem semantics. +Enable the blob service to exhibit filesystem semantics.\ *Examples:* ``` az storage account create \ diff --git a/src/storage-preview/azext_storage_preview/vendored_sdks/__init__.py b/src/storage-preview/azext_storage_preview/vendored_sdks/__init__.py index de40ea7ca05..a5b81f3bde4 100644 --- a/src/storage-preview/azext_storage_preview/vendored_sdks/__init__.py +++ b/src/storage-preview/azext_storage_preview/vendored_sdks/__init__.py @@ -1 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + __import__('pkg_resources').declare_namespace(__name__) diff --git a/src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/__init__.py b/src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/__init__.py index de40ea7ca05..a5b81f3bde4 100644 --- a/src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/__init__.py +++ b/src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/__init__.py @@ -1 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + __import__('pkg_resources').declare_namespace(__name__) diff --git a/src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/v2018_03_28/__init__.py b/src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/v2018_03_28/__init__.py index de40ea7ca05..34913fb394d 100644 --- a/src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/v2018_03_28/__init__.py +++ b/src/storage-preview/azext_storage_preview/vendored_sdks/azure_storage/v2018_03_28/__init__.py @@ -1 +1,4 @@ -__import__('pkg_resources').declare_namespace(__name__) +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# --------------------------------------------------------------------------------------------