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..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,39 +31,26 @@ 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) - 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] - if prompt: - pass - subprocess.call(create_space_arguments, universal_newlines=True) - - -def ads_remove_dev_spaces(cluster_name, resource_group_name, prompt=False): + 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 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, do_not_prompt=False): """ Remove Azure Dev Spaces from a managed Kubernetes cluster. @@ -72,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, 'controller', 'delete', '--name', - cluster_name, '--resource-group', resource_group_name] - if prompt: + remove_command_arguments = [azds_cli, 'remove', '--name', cluster_name, + '--resource-group', resource_group_name] + if do_not_prompt: remove_command_arguments.append('-y') subprocess.call( remove_command_arguments, universal_newlines=True) 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..2ba14c5de99 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": "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, "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" } } ],