From e8e1d2bbca39442bea599ac586fb8a69588e8eae Mon Sep 17 00:00:00 2001 From: Saurabh Sarkar Date: Tue, 19 Jun 2018 16:30:51 -0700 Subject: [PATCH 1/5] Updating az use call to azds cli - addressing azds updated cli --- .../azext_dev_spaces_preview/custom.py | 37 ++++++------------- src/dev-spaces-preview/setup.py | 2 +- src/index.json | 8 ++-- 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py index f2e212d93c6..3b11e985507 100644 --- a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py +++ b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py @@ -37,30 +37,17 @@ def ads_use_dev_spaces(cluster_name, resource_group_name, update=False, space_na azds_cli = _install_dev_spaces_cli(update) - from subprocess import PIPE - retCode = subprocess.call( - [azds_cli, 'controller', 'select', '--name', cluster_name, '--resource-group', resource_group_name], - stderr=PIPE) - if retCode != 0: - retCode = subprocess.call( - [azds_cli, 'controller', 'create', '--target-name', cluster_name, '--target-resource-group', - resource_group_name, '--name', cluster_name, '--resource-group', resource_group_name], - universal_newlines=True) - if retCode != 0: - return - - if space_name is None: - space_name = 'default' - - retCode = subprocess.call( - [azds_cli, 'space', 'select', '--name', space_name], stderr=PIPE) - if retCode == 0: - return - - create_space_arguments = [azds_cli, 'space', 'create', '--name', space_name] + use_command_arguments = [azds_cli, 'use', '--name', cluster_name, + '--resource-group', resource_group_name] + + if space_name is not None: + use_command_arguments.append('--space') + use_command_arguments.append(space_name) + if prompt: - pass - subprocess.call(create_space_arguments, universal_newlines=True) + use_command_arguments.append('-y') + subprocess.call( + use_command_arguments, universal_newlines=True) def ads_remove_dev_spaces(cluster_name, resource_group_name, prompt=False): @@ -78,8 +65,8 @@ def ads_remove_dev_spaces(cluster_name, resource_group_name, prompt=False): azds_cli = _install_dev_spaces_cli(False) - remove_command_arguments = [azds_cli, 'controller', 'delete', '--name', - cluster_name, '--resource-group', resource_group_name] + remove_command_arguments = [azds_cli, 'remove', '--name', cluster_name, + '--resource-group', resource_group_name] if prompt: remove_command_arguments.append('-y') subprocess.call( diff --git a/src/dev-spaces-preview/setup.py b/src/dev-spaces-preview/setup.py index fe3a69ba5db..44b5d14fe45 100644 --- a/src/dev-spaces-preview/setup.py +++ b/src/dev-spaces-preview/setup.py @@ -7,7 +7,7 @@ from setuptools import setup, find_packages -VERSION = "0.1.4" +VERSION = "0.1.5" CLASSIFIERS = [ 'Development Status :: 4 - Beta', diff --git a/src/index.json b/src/index.json index 0595e200cab..c9fd9ddd7e5 100644 --- a/src/index.json +++ b/src/index.json @@ -370,9 +370,9 @@ ], "dev-spaces-preview": [ { - "filename": "dev_spaces_preview-0.1.4-py2.py3-none-any.whl", - "sha256Digest": "cd2d50ea8a3a46a4b86d3a8810341b05205b91d87b8e9e5c26e7536714bad7ff", - "downloadUrl": "https://azuredevspacestools.blob.core.windows.net/azdssetup/LKS/dev_spaces_preview-0.1.4-py2.py3-none-any.whl", + "filename": "dev_spaces_preview-0.1.5-py2.py3-none-any.whl", + "sha256Digest": "8877d0e8ae062b892803b982bdea5122f311e8540f854e107a4e4914bb32cd1d", + "downloadUrl": "https://azuredevspacestools.blob.core.windows.net/azdssetup/LKS/dev_spaces_preview-0.1.5-py2.py3-none-any.whl", "metadata": { "azext.isPreview": true, "azext.minCliCoreVersion": "2.0.32", @@ -411,7 +411,7 @@ "metadata_version": "2.0", "name": "dev-spaces-preview", "summary": "Dev Spaces provides a rapid, iterative Kubernetes development experience for teams.", - "version": "0.1.4" + "version": "0.1.5" } } ], From 4c26647dd7cfb4b9065eed5bbb5e1ff2196c9218 Mon Sep 17 00:00:00 2001 From: Saurabh Sarkar Date: Tue, 19 Jun 2018 17:24:23 -0700 Subject: [PATCH 2/5] Fix indentation error --- src/dev-spaces-preview/azext_dev_spaces_preview/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py index 3b11e985507..9fde850d509 100644 --- a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py +++ b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py @@ -66,7 +66,7 @@ def ads_remove_dev_spaces(cluster_name, resource_group_name, prompt=False): azds_cli = _install_dev_spaces_cli(False) remove_command_arguments = [azds_cli, 'remove', '--name', cluster_name, - '--resource-group', resource_group_name] + '--resource-group', resource_group_name] if prompt: remove_command_arguments.append('-y') subprocess.call( From 69006b5631718f62ee349de7f186336630668f0e Mon Sep 17 00:00:00 2001 From: Saurabh Sarkar Date: Tue, 19 Jun 2018 23:44:43 -0700 Subject: [PATCH 3/5] update --- src/dev-spaces-preview/azext_dev_spaces_preview/custom.py | 2 +- src/index.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py index 9fde850d509..cd60ae9326c 100644 --- a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py +++ b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py @@ -40,7 +40,7 @@ def ads_use_dev_spaces(cluster_name, resource_group_name, update=False, space_na use_command_arguments = [azds_cli, 'use', '--name', cluster_name, '--resource-group', resource_group_name] - if space_name is not None: + if not space_name is None: use_command_arguments.append('--space') use_command_arguments.append(space_name) diff --git a/src/index.json b/src/index.json index c9fd9ddd7e5..2f9433725a4 100644 --- a/src/index.json +++ b/src/index.json @@ -371,7 +371,7 @@ "dev-spaces-preview": [ { "filename": "dev_spaces_preview-0.1.5-py2.py3-none-any.whl", - "sha256Digest": "8877d0e8ae062b892803b982bdea5122f311e8540f854e107a4e4914bb32cd1d", + "sha256Digest": "d13cccd70c19becc4ff0b491d2606a8001acadc938708632e35176558f483d99", "downloadUrl": "https://azuredevspacestools.blob.core.windows.net/azdssetup/LKS/dev_spaces_preview-0.1.5-py2.py3-none-any.whl", "metadata": { "azext.isPreview": true, From 711efb7a91a7bd1c393e973df8646c2e0c8f0fbb Mon Sep 17 00:00:00 2001 From: Saurabh Sarkar Date: Wed, 20 Jun 2018 00:36:03 -0700 Subject: [PATCH 4/5] Update --- src/dev-spaces-preview/azext_dev_spaces_preview/custom.py | 2 +- src/index.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py index cd60ae9326c..9fde850d509 100644 --- a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py +++ b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py @@ -40,7 +40,7 @@ def ads_use_dev_spaces(cluster_name, resource_group_name, update=False, space_na use_command_arguments = [azds_cli, 'use', '--name', cluster_name, '--resource-group', resource_group_name] - if not space_name is None: + if space_name is not None: use_command_arguments.append('--space') use_command_arguments.append(space_name) diff --git a/src/index.json b/src/index.json index 2f9433725a4..2ba14c5de99 100644 --- a/src/index.json +++ b/src/index.json @@ -371,7 +371,7 @@ "dev-spaces-preview": [ { "filename": "dev_spaces_preview-0.1.5-py2.py3-none-any.whl", - "sha256Digest": "d13cccd70c19becc4ff0b491d2606a8001acadc938708632e35176558f483d99", + "sha256Digest": "28077ae576f5a86dca30f7def0308d3a26d7464f91f82109c1dc8fc4b11c6a6f", "downloadUrl": "https://azuredevspacestools.blob.core.windows.net/azdssetup/LKS/dev_spaces_preview-0.1.5-py2.py3-none-any.whl", "metadata": { "azext.isPreview": true, From 6540c04ae176560a69d60c95fd5ac9fcde4293d3 Mon Sep 17 00:00:00 2001 From: Saurabh Sarkar Date: Wed, 20 Jun 2018 13:26:04 -0700 Subject: [PATCH 5/5] CR: renaming the prompt variable --- .../azext_dev_spaces_preview/custom.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py index 9fde850d509..c84a6d4c622 100644 --- a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py +++ b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py @@ -18,7 +18,7 @@ # pylint:disable=no-member,too-many-lines,too-many-locals,too-many-statements -def ads_use_dev_spaces(cluster_name, resource_group_name, update=False, space_name=None, prompt=False): +def ads_use_dev_spaces(cluster_name, resource_group_name, update=False, space_name=None, do_not_prompt=False): """ Use Azure Dev Spaces with a managed Kubernetes cluster. @@ -31,8 +31,8 @@ def ads_use_dev_spaces(cluster_name, resource_group_name, update=False, space_na :type update: bool :param space_name: Name of the new or existing dev space to select. Defaults to an interactive selection experience. :type space_name: String - :param prompt: Do not prompt for confirmation. Requires --space. - :type prompt: bool + :param do_not_prompt: Do not prompt for confirmation. Requires --space. + :type do_not_prompt: bool """ azds_cli = _install_dev_spaces_cli(update) @@ -44,13 +44,13 @@ def ads_use_dev_spaces(cluster_name, resource_group_name, update=False, space_na use_command_arguments.append('--space') use_command_arguments.append(space_name) - if prompt: + if do_not_prompt: use_command_arguments.append('-y') subprocess.call( use_command_arguments, universal_newlines=True) -def ads_remove_dev_spaces(cluster_name, resource_group_name, prompt=False): +def ads_remove_dev_spaces(cluster_name, resource_group_name, do_not_prompt=False): """ Remove Azure Dev Spaces from a managed Kubernetes cluster. @@ -59,15 +59,15 @@ def ads_remove_dev_spaces(cluster_name, resource_group_name, prompt=False): :param resource_group_name: Name of resource group. You can configure the default group. \ Using 'az configure --defaults group='. :type resource_group_name: String - :param prompt: Do not prompt for confirmation. - :type prompt: bool + :param do_not_prompt: Do not prompt for confirmation. + :type do_not_prompt: bool """ azds_cli = _install_dev_spaces_cli(False) remove_command_arguments = [azds_cli, 'remove', '--name', cluster_name, '--resource-group', resource_group_name] - if prompt: + if do_not_prompt: remove_command_arguments.append('-y') subprocess.call( remove_command_arguments, universal_newlines=True)