Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating some params of use command #200

Merged
merged 7 commits into from
Jun 19, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/dev-spaces-preview/azext_dev_spaces_preview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why are all the commands now being removed? Did I miss something??


COMMAND_LOADER_CLS = DevspacesExtCommandLoader
36 changes: 0 additions & 36 deletions src/dev-spaces-preview/azext_dev_spaces_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -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>'.
- 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>'.
- name: --yes -y
type: bool
short-summary: Do not prompt for confirmation.
"""
21 changes: 11 additions & 10 deletions src/dev-spaces-preview/azext_dev_spaces_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# pylint:disable=no-member,too-many-lines,too-many-locals,too-many-statements,too-few-public-methods


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.

Expand All @@ -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=<name>'.
: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)
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't do anything......

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We want to have it passed from azure-cli, so added it in the signature. Will add the functionality when the underlying cli (azds) will support it, in the next release.

subprocess.call(create_space_arguments, universal_newlines=True)


Expand Down
2 changes: 1 addition & 1 deletion src/dev-spaces-preview/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from setuptools import setup, find_packages

VERSION = "0.1.3"
VERSION = "0.1.4"

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
8 changes: 4 additions & 4 deletions src/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,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": "65018b216869c6491cc0da5fea1e56124561eecaaedcb9a629465debd18348c3",
"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",
Expand Down Expand Up @@ -367,7 +367,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"
}
}
],
Expand Down