From 8550e71d2a5de8c2dec1162f7c73de783db789d0 Mon Sep 17 00:00:00 2001 From: Sayan Naskar Date: Fri, 20 May 2022 19:45:28 +0530 Subject: [PATCH 1/4] requesting details if empty --- src/scvmm/azext_scvmm/custom.py | 30 ++++++++++++++++++++++++------ src/scvmm/setup.py | 3 +-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/scvmm/azext_scvmm/custom.py b/src/scvmm/azext_scvmm/custom.py index 48f38f10c2b..5f5f8e9b101 100644 --- a/src/scvmm/azext_scvmm/custom.py +++ b/src/scvmm/azext_scvmm/custom.py @@ -88,26 +88,43 @@ def connect_vmmserver( fqdn=None, username=None, password=None, - port=DEFAULT_VMMSERVER_PORT, + port=None, tags=None, no_wait=False, ): - creds_ok = all(inp is not None for inp in [fqdn, username, password]) + creds_ok = all(inp is not None for inp in [fqdn, port, username, password]) while not creds_ok: creds = { 'fqdn': fqdn, + 'port': port, 'username': username, 'password': password, } - if fqdn is None: + while not creds['fqdn']: print('Please provide vmmserver FQDN or IP address: ', end='') creds['fqdn'] = input() - if username is None: + if not creds['fqdn']: + print('Parameter is required, please try again') + while not creds['port']: + print('Please provide vmmserver port (Default: 8100): ', end='') + try: + creds['port'] = input() + if not creds['port']: + creds['port'] = DEFAULT_VMMSERVER_PORT + creds['port'] = int(creds['port']) + except ValueError: + print('Port must be a number, please try again') + creds['port'] = None + while not creds['username']: print('Please provide vmmserver username: ', end='') creds['username'] = input() - if password is None: + if not creds['username']: + print('Parameter is required, please try again') + while not creds['password']: creds['password'] = getpass('Please provide vmmserver password: ') + if not creds['password']: + print('Parameter is required, please try again') print('Confirm vmmserver details? [Y/n]: ', end='') res = input().lower() if res in ['y', '']: @@ -118,8 +135,9 @@ def connect_vmmserver( file=sys.stderr, ) continue - fqdn, username, password = ( + fqdn, port, username, password = ( creds['fqdn'], + creds['port'], creds['username'], creds['password'], ) diff --git a/src/scvmm/setup.py b/src/scvmm/setup.py index f621a598005..2dad5baef20 100644 --- a/src/scvmm/setup.py +++ b/src/scvmm/setup.py @@ -46,8 +46,7 @@ # TODO: Update author and email, if applicable author='Microsoft Corporation', author_email='azpycli@microsoft.com', - # TODO: consider pointing directly to your source code instead of the generic repo - url='https://github.com/Azure/azure-cli-extensions/tree/main/src/connectedvmware', + url='https://github.com/Azure/azure-cli-extensions/tree/main/src/scvmm', long_description=README + '\n\n' + HISTORY, license='MIT', classifiers=CLASSIFIERS, From 5cf44f57c615d0a2a17f6c27e957ded3aa0f803d Mon Sep 17 00:00:00 2001 From: Sayan Naskar Date: Fri, 20 May 2022 19:50:00 +0530 Subject: [PATCH 2/4] readme.rst --- src/scvmm/HISTORY.rst | 5 +++++ src/scvmm/setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scvmm/HISTORY.rst b/src/scvmm/HISTORY.rst index 98a60f9e283..1624ed1da10 100644 --- a/src/scvmm/HISTORY.rst +++ b/src/scvmm/HISTORY.rst @@ -26,3 +26,8 @@ Release History * Force and retain flags in VM delete * Generated SDK now requires updated version of azure-cli * Long running PATCH operations + +0.1.5 ++++ +* Requesting VMMServer credentials from the user until they are empty. +* Removing default value for port. Asking for the input. If input is empty, setting port to 8100. diff --git a/src/scvmm/setup.py b/src/scvmm/setup.py index 2dad5baef20..14d80716d31 100644 --- a/src/scvmm/setup.py +++ b/src/scvmm/setup.py @@ -16,7 +16,7 @@ logger.warn("Wheel is not available, disabling bdist_wheel hook") -VERSION = '0.1.4' +VERSION = '0.1.5' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers From 6b2d6b557a7c86b1dfce1b4c56cfb65a16e064c1 Mon Sep 17 00:00:00 2001 From: Sayan Naskar Date: Thu, 26 May 2022 18:40:17 +0530 Subject: [PATCH 3/4] Fix changelog message Co-authored-by: ZelinWang --- src/scvmm/HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scvmm/HISTORY.rst b/src/scvmm/HISTORY.rst index 1624ed1da10..b92b440a91f 100644 --- a/src/scvmm/HISTORY.rst +++ b/src/scvmm/HISTORY.rst @@ -29,5 +29,5 @@ Release History 0.1.5 +++ -* Requesting VMMServer credentials from the user until they are empty. +* Requesting VMMServer credentials from the user until they are non-empty. * Removing default value for port. Asking for the input. If input is empty, setting port to 8100. From 1fb23975f5e964eabfae45f11f3b7e69f71e17bb Mon Sep 17 00:00:00 2001 From: Sayan Naskar Date: Sat, 4 Jun 2022 13:13:09 +0530 Subject: [PATCH 4/4] readme.rst changes --- src/scvmm/HISTORY.rst | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/scvmm/HISTORY.rst b/src/scvmm/HISTORY.rst index b92b440a91f..07e40a48506 100644 --- a/src/scvmm/HISTORY.rst +++ b/src/scvmm/HISTORY.rst @@ -3,31 +3,31 @@ Release History =============== -0.1.0 +0.1.5 ++++ +* Requesting VMMServer credentials from the user until they are non-empty. +* [BREAKING CHANGE] Removing default value for port. Asking for the input. If input is empty, setting port to 8100. + +0.1.4 ++++++ -* Initial release. +* Bug fixes +* Force and retain flags in VM delete +* Generated SDK now requires updated version of azure-cli +* Long running PATCH operations -0.1.1 +0.1.3 ++++++ -* CRUD of VMMServer, Cloud, VMTemplate, VM. Tags Supported. azdev lint passing. +* View Inventory, onboard inventory item to azure. +* CRUD for availablity sets. 0.1.2 ++++++ * Interactive password. -0.1.3 +0.1.1 ++++++ -* View Inventory, onboard inventory item to azure. -* CRUD for availablity sets. +* CRUD of VMMServer, Cloud, VMTemplate, VM. Tags Supported. azdev lint passing. -0.1.4 +0.1.0 ++++++ -* Bug fixes -* Force and retain flags in VM delete -* Generated SDK now requires updated version of azure-cli -* Long running PATCH operations - -0.1.5 -+++ -* Requesting VMMServer credentials from the user until they are non-empty. -* Removing default value for port. Asking for the input. If input is empty, setting port to 8100. +* Initial release.