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 606739008fe..c41a62e4cf7 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 +# 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): # pylint: disable=line-too-long +def ads_use_dev_spaces(cluster_name, resource_group_name, space_name='default', parent_space_name=None): """ Use Azure Dev Spaces with a managed Kubernetes cluster. @@ -37,37 +37,30 @@ def ads_use_dev_spaces(cluster_name, resource_group_name, space_name='default', azds_cli = _install_dev_spaces_cli() from subprocess import PIPE - should_create_resource = False retCode = subprocess.call( [azds_cli, 'resource', 'select', '-n', cluster_name, '-g', resource_group_name], stderr=PIPE) - if retCode == 1: - should_create_resource = True - - if should_create_resource: + if retCode != 0: retCode = subprocess.call( [azds_cli, 'resource', 'create', '--aks-name', cluster_name, '--aks-resource-group', resource_group_name, '--name', cluster_name, '--resource-group', resource_group_name], universal_newlines=True) + if retCode != 0: + return - if retCode == 0: - should_create_spaces = False - create_space_arguments = [azds_cli, 'space', 'select', '--name', space_name] - if parent_space_name is not None: - create_space_arguments.append('--parent') - create_space_arguments.append(parent_space_name) - retCode = subprocess.call( - create_space_arguments, stderr=PIPE) - if retCode == 1: - should_create_spaces = True + retCode = subprocess.call( + [azds_cli, 'space', 'select', '--name', space_name], stderr=PIPE) + if retCode == 0: + return - if should_create_spaces: - subprocess.call( - [azds_cli, 'space', 'create', '--name', space_name], - universal_newlines=True) + 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) + subprocess.call(create_space_arguments, universal_newlines=True) -def ads_remove_dev_spaces(cluster_name, resource_group_name, prompt=False): # pylint: disable=line-too-long +def ads_remove_dev_spaces(cluster_name, resource_group_name, prompt=False): """ Remove Azure Dev Spaces from a managed Kubernetes cluster. @@ -121,7 +114,7 @@ def _install_dev_spaces_cli(): # OSX azds_cli = 'azds' setup_file = os.path.join(_create_tmp_dir(), 'azds-osx-setup.sh') - setup_url = "https://aka.ms/get-azds-osx-az" + setup_url = "https://aka.ms/get-azds-mac-az" setup_args = ['bash', setup_file] elif system == 'Linux': # Linux diff --git a/src/dev-spaces-preview/setup.py b/src/dev-spaces-preview/setup.py index 4b492c16c52..ae3fc2187ab 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.1" +VERSION = "0.1.2" CLASSIFIERS = [ 'Development Status :: 4 - Beta', diff --git a/src/index.json b/src/index.json index cc0c320060c..a7a8d32c29a 100644 --- a/src/index.json +++ b/src/index.json @@ -326,9 +326,9 @@ ], "dev-spaces-preview": [ { - "filename": "dev_spaces_preview-0.1.1-py2.py3-none-any.whl", - "sha256Digest": "59557d90999178dddbdcb14590202efe3d4d016186484ce33cfe0984a312c73b", - "downloadUrl": "https://azuredevspacestools.blob.core.windows.net/azdssetup/LKS/dev_spaces_preview-0.1.1-py2.py3-none-any.whl", + "filename": "dev_spaces_preview-0.1.2-py2.py3-none-any.whl", + "sha256Digest": "84d0470bb45cee94f62580927dc5ed2ab5be9e110ce8f836153e277f7547e012", + "downloadUrl": "https://azuredevspacestools.blob.core.windows.net/azdssetup/LKS/dev_spaces_preview-0.1.2-py2.py3-none-any.whl", "metadata": { "azext.isPreview": true, "azext.minCliCoreVersion": "2.0.32", @@ -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.1" + "version": "0.1.2" } } ],