From 51546ba6e52043164148a5ad7adf02f79ae60d04 Mon Sep 17 00:00:00 2001 From: Sisira Panchagnula Date: Wed, 7 Mar 2018 10:53:51 -0800 Subject: [PATCH] Fixes#69: Add url after create in json, also changing to return json object instead of string (#96) Fixes#95: Updating the default version of Node Fixes:#75:Remove generated zip file after the creating and deploying the app Updating index.json --- src/index.json | 8 ++++---- src/webapp/azext_webapp/_constants.py | 2 +- src/webapp/azext_webapp/custom.py | 21 ++++++++++++++------- src/webapp/setup.py | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/index.json b/src/index.json index c3d4d5c7473..b536a29170d 100644 --- a/src/index.json +++ b/src/index.json @@ -370,9 +370,9 @@ ], "webapp": [ { - "filename": "webapp-0.1.1-py2.py3-none-any.whl", - "sha256Digest": "65b976e57f766b0b8dcb31e13903f7a05515a80dcafcb03a6b5dce64bc8a5594", - "downloadUrl": "https://github.com/panchagnula/azure-cli-extensions/raw/sisirap-extensions-whl/dist/webapp-0.1.1-py2.py3-none-any.whl", + "filename": "webapp-0.1.2-py2.py3-none-any.whl", + "sha256Digest": "6fb8a59aa38dff6b0d3a878742290cacac0eb0e50dc0fae2e6fbf7bd5c38f37b", + "downloadUrl": "https://github.com/panchagnula/azure-cli-extensions/raw/sisirap-extensions-whl/dist/webapp-0.1.2-py2.py3-none-any.whl", "metadata": { "classifiers": [ "Development Status :: 4 - Beta", @@ -409,7 +409,7 @@ "metadata_version": "2.0", "name": "webapp", "summary": "An Azure CLI Extension to manage appservice resources", - "version": "0.1.1" + "version": "0.1.2" } } ], diff --git a/src/webapp/azext_webapp/_constants.py b/src/webapp/azext_webapp/_constants.py index f5b0e8c9126..f218f175fee 100644 --- a/src/webapp/azext_webapp/_constants.py +++ b/src/webapp/azext_webapp/_constants.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -NODE_VERSION_DEFAULT = "8.1" +NODE_VERSION_DEFAULT = "8.9" NETCORE_VERSION_DEFAULT = "2.0" # TODO: Remove this once we have the api returning the versions NODE_VERSIONS = ['4.4', '4.5', '6.2', '6.6', '6.9', '6.11', '8.0', '8.1'] diff --git a/src/webapp/azext_webapp/custom.py b/src/webapp/azext_webapp/custom.py index b20db39aee0..2d338535d9e 100644 --- a/src/webapp/azext_webapp/custom.py +++ b/src/webapp/azext_webapp/custom.py @@ -109,13 +109,12 @@ def create_deploy_webapp(cmd, name, location=None, dryrun=False): } """ % (name, asp, rg_str, full_sku, os_val, location, src_path, detected_version, runtime_version) + create_json = json.loads(dry_run_str) - create_json = json.dumps(json.loads(dry_run_str), indent=4, sort_keys=True) if dryrun: logger.warning("Web app will be created with the below configuration,re-run command " "without the --dryrun flag to create & deploy a new app") - logger.warning(create_json) - return None + return create_json # create RG if the RG doesn't already exist if not check_resource_group_exists(cmd, rg_name): @@ -139,7 +138,10 @@ def create_deploy_webapp(cmd, name, location=None, dryrun=False): # create the app if not check_app_exists(cmd, rg_name, name): logger.warning("Creating app '%s' ....", name) - create_webapp(cmd, rg_name, name, asp, runtime_version if is_linux else None) + app_created = create_webapp(cmd, rg_name, name, asp, runtime_version if is_linux else None) + # update create_json to include the app_url + url = app_created.enabled_host_names[0] # picks the custom domain URL incase a domain is assigned + url = 'https://' + url logger.warning("Webapp creation complete") else: logger.warning("App '%s' already exists", name) @@ -166,8 +168,13 @@ def create_deploy_webapp(cmd, name, location=None, dryrun=False): logger.warning("Deploying and building contents to app." "This operation can take some time to finish...") enable_zip_deploy(cmd, rg_name, name, zip_file_path) + # Remove the file afer deployment, handling exception if user removed the file manually + try: + os.remove(zip_file_path) + except OSError: + pass else: logger.warning("No 'NODE' or 'DOTNETCORE' package detected, skipping zip and deploy process") - - logger.warning("All done. %s", create_json) - return None + create_json.update({'app_url': url}) + logger.warning("All done.") + return create_json diff --git a/src/webapp/setup.py b/src/webapp/setup.py index d41730826a9..d8f5bca8d17 100644 --- a/src/webapp/setup.py +++ b/src/webapp/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.1.1" +VERSION = "0.1.2" CLASSIFIERS = [ 'Development Status :: 4 - Beta',