From 39abf175b4f16c1f639024cddb689312bd2b29af Mon Sep 17 00:00:00 2001 From: navba-MSFT <57353862+navba-MSFT@users.noreply.github.com> Date: Tue, 9 Aug 2022 13:45:52 +0530 Subject: [PATCH] [Batch] Fix #23445: `az batch pool supported-images list`: Fix the `NoneType object has no attribute startswith` bug for getting supported images list (#23449) --- .../azure/cli/command_modules/batch/_validators.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/batch/_validators.py b/src/azure-cli/azure/cli/command_modules/batch/_validators.py index c6a8661133f..f9d2c35cfa8 100644 --- a/src/azure-cli/azure/cli/command_modules/batch/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/batch/_validators.py @@ -304,10 +304,10 @@ def validate_client_parameters(cmd, namespace): namespace.account_endpoint = cmd.cli_ctx.config.get('batch', 'endpoint', None) # Simple validation for account_endpoint - if not (namespace.account_endpoint.startswith('https://') or - namespace.account_endpoint.startswith('http://')): + if namespace.account_endpoint and not (namespace.account_endpoint.startswith('https://') or + namespace.account_endpoint.startswith('http://')): namespace.account_endpoint = 'https://' + namespace.account_endpoint - namespace.account_endpoint = namespace.account_endpoint.rstrip('/') + namespace.account_endpoint = namespace.account_endpoint.rstrip('/') # if account name is specified but no key, attempt to query if we use shared key auth if namespace.account_name and namespace.account_endpoint and not namespace.account_key: if cmd.cli_ctx.config.get('batch', 'auth_mode', 'shared_key') == 'shared_key':