diff --git a/src/dev-spaces-preview/azext_dev_spaces_preview/__init__.py b/src/dev-spaces-preview/azext_dev_spaces_preview/__init__.py index dcc54359b78..f9965993844 100644 --- a/src/dev-spaces-preview/azext_dev_spaces_preview/__init__.py +++ b/src/dev-spaces-preview/azext_dev_spaces_preview/__init__.py @@ -9,7 +9,7 @@ import azext_dev_spaces_preview.custom # pylint: disable=unused-import -class DevspacesExtCommandLoader(AzCommandsLoader): +class DevspacesExtCommandLoader(AzCommandsLoader): # pylint:disable=too-few-public-methods def __init__(self, cli_ctx=None): from azure.cli.core.commands import CliCommandType @@ -19,24 +19,5 @@ def __init__(self, cli_ctx=None): custom_command_type=dev_spaces_custom, min_profile='2017-03-10-profile') - def load_command_table(self, _): - with self.command_group('ads') as g: - g.custom_command('use', 'ads_use_dev_spaces') - g.custom_command('remove', 'ads_remove_dev_spaces') - return self.command_table - - def load_arguments(self, _): - with self.argument_context('ads use') as c: - c.argument('cluster_name', options_list=['--name', '-n']) - c.argument('resource_group_name', options_list=['--resource-group', '-g']) - c.argument('space_name', options_list=['--space', '-s']) - c.argument('parent_space_name', options_list=['--parent-space', '-p']) - c.argument('update', options_list=['--update'], action='store_true') - - with self.argument_context('ads remove') as c: - c.argument('cluster_name', options_list=['--name', '-n']) - c.argument('resource_group_name', options_list=['--resource-group', '-g']) - c.argument('prompt', options_list=['--yes', '-y'], action='store_true') - COMMAND_LOADER_CLS = DevspacesExtCommandLoader diff --git a/src/dev-spaces-preview/azext_dev_spaces_preview/_help.py b/src/dev-spaces-preview/azext_dev_spaces_preview/_help.py index 4cb32dde30e..b1dd52b6e04 100644 --- a/src/dev-spaces-preview/azext_dev_spaces_preview/_help.py +++ b/src/dev-spaces-preview/azext_dev_spaces_preview/_help.py @@ -12,39 +12,3 @@ type: group short-summary: (PREVIEW) Manage Azure Dev Spaces. """ - -helps['ads use'] = """ - type: command - short-summary: (PREVIEW) Use Azure Dev Spaces with a managed Kubernetes cluster. - parameters: - - name: --name -n - type: string - short-summary: Name of the managed cluster. - - name: --resource-group -g - type: string - short-summary: Name of resource group. You can configure the default group using 'az configure --defaults group='. - - name: --space -s - type: string - short-summary: Name of the dev space to use. - - name: --parent-space -p - type: string - short-summary: Name of a parent dev space to inherit from when creating a new dev space. By default, if there is already a single dev space with no parent, the new space inherits from this one. - - name: --update - type: bool - short-summary: Update Azure Dev Spaces tools. -""" - -helps['ads remove'] = """ - type: command - short-summary: (PREVIEW) Remove Azure Dev Spaces from a managed Kubernetes cluster. - parameters: - - name: --name -n - type: string - short-summary: Name of the managed cluster. - - name: --resource-group -g - type: string - short-summary: Name of resource group. You can configure the default group using 'az configure --defaults group='. - - name: --yes -y - type: bool - short-summary: Do not prompt for confirmation. -""" 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 cb48818b045..f2e212d93c6 100644 --- a/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py +++ b/src/dev-spaces-preview/azext_dev_spaces_preview/custom.py @@ -15,10 +15,10 @@ logger = get_logger(__name__) -# pylint:disable=no-member,too-many-lines,too-many-locals,too-many-statements,too-few-public-methods +# pylint:disable=no-member,too-many-lines,too-many-locals,too-many-statements -def ads_use_dev_spaces(cluster_name, resource_group_name, space_name='default', parent_space_name=None, update=False): +def ads_use_dev_spaces(cluster_name, resource_group_name, update=False, space_name=None, prompt=False): """ Use Azure Dev Spaces with a managed Kubernetes cluster. @@ -27,13 +27,12 @@ def ads_use_dev_spaces(cluster_name, resource_group_name, space_name='default', :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 space_name: Name of the dev space to use. - :type space_name: String - :param parent_space_name: Name of a parent dev space to inherit from when creating a new dev space. \ - By default, if there is already a single dev space with no parent, the new space inherits from this one. - :type parent_space_name: String - :param update: Update Azure Dev Spaces tools. + :param update: Update to the latest Azure Dev Spaces client components. :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 """ azds_cli = _install_dev_spaces_cli(update) @@ -50,15 +49,17 @@ def ads_use_dev_spaces(cluster_name, resource_group_name, space_name='default', 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 parent_space_name is not None: - create_space_arguments.append('--parent') - create_space_arguments.append(parent_space_name) + if prompt: + pass subprocess.call(create_space_arguments, universal_newlines=True) diff --git a/src/dev-spaces-preview/setup.py b/src/dev-spaces-preview/setup.py index a08d80e1644..fe3a69ba5db 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.3" +VERSION = "0.1.4" CLASSIFIERS = [ 'Development Status :: 4 - Beta', diff --git a/src/index.json b/src/index.json index 0961f31b8ca..0595e200cab 100644 --- a/src/index.json +++ b/src/index.json @@ -370,9 +370,9 @@ ], "dev-spaces-preview": [ { - "filename": "dev_spaces_preview-0.1.3-py2.py3-none-any.whl", - "sha256Digest": "3d431ce5a0f873b41c87dda411bec3a1851c9ac2cb86b566b5317980f3eb116b", - "downloadUrl": "https://azuredevspacestools.blob.core.windows.net/azdssetup/LKS/dev_spaces_preview-0.1.3-py2.py3-none-any.whl", + "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", "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.3" + "version": "0.1.4" } } ],