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

Unable to create flexible postgres server via CLI in most recent version #27977

Closed
Turniper opened this issue Dec 6, 2023 · 12 comments
Closed
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. PostgreSQL Service Attention This issue is responsible by Azure service team. Similar-Issue

Comments

@Turniper
Copy link

Turniper commented Dec 6, 2023

Describe the bug

With the latest version of the cli (2.55.0), the command:

az postgres flexible-server create

fails with an internal error rather than a message. The exact same command succeeds in azure-cli version 2.54.0, which we are currently using as a fallback.

Related command

az postgres flexible-server create --admin-password $POSTGRES_PASSWORD \
                                   --admin-user name_redacted \
                                   --location $LOCATION \
                                   --resource-group $RESOURCE_GROUP \
                                   --name $POSTGRES_NAME \
                                   --sku-name Standard_D4ds_v4 \
                                   --tier GeneralPurpose \
                                   --storage-size 512 \
                                   --version 11 \
                                   --high-availability Disabled \
                                   --backup-retention 14 \
                                   --geo-redundant-backup Disabled \
                                   --yes

Errors

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: list index out of range
Traceback (most recent call last):
File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 333, in call
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py", line 69, in flexible_server_create
pg_arguments_validator(db_context,
File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/rdbms/validators.py", line 305, in pg_arguments_validator
list_location_capability_info = get_postgres_location_capability_info(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/rdbms/_flexible_server_location_capabilities_util.py", line 15, in get_postgres_location_capability_info
return _postgres_parse_list_capability(list_location_capability_result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/rdbms/_flexible_server_location_capabilities_util.py", line 79, in _postgres_parse_list_capability
tier_dict["supported_storageV2_size"] = int(storage_edition.supported_storage_mb[0].storage_size_mb // 1024)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Issue script & Debug output

See related command. If you need the full script I can provide it, but that's the relevant section that's failing.

Expected behavior

Either a successful creation of the flexible postgres server resource or a message about one or more of the parameters being invalid

Environment Summary

azure-cli 2.55.0-1~focal

Additional context

Only included the command itself and not the full script for anonymization reasons but can provide any more context you need.

@Turniper Turniper added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Dec 6, 2023
Copy link

Hi @Turniper
Find similar issue #10117.

Issue title webapp: az webapp up failed
Create time 2019-08-01
Comment number 3

Please confirm if this resolves your issue.

@microsoft-github-policy-service microsoft-github-policy-service bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Dec 6, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Auto-Assign Auto assign by bot Service Attention This issue is responsible by Azure service team. PostgreSQL labels Dec 6, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Dec 6, 2023

Thank you for opening this issue, we will look into it.

@gohmc
Copy link

gohmc commented Dec 7, 2023

This error also hit CLI 2.54. But I believe this is not a CLI issue but the backend API has returned invalid capabilities json structure; which result to the Python script loop to invalid condition statement here.

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: list index out of range
Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py", line 69, in flexible_server_create
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/rdbms/validators.py", line 305, in pg_arguments_validator
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/rdbms/_flexible_server_location_capabilities_util.py", line 15, in get_postgres_location_capability_info
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/rdbms/_flexible_server_location_capabilities_util.py", line 79, in _postgres_parse_list_capability
IndexError: list index out of range
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

@felleg
Copy link

felleg commented Dec 7, 2023

I just ran a test using pip3 install azure-cli==2.53.0 and it seems to be running my az postgres flexible-server fine.

@DavidGoodwin
Copy link

I just ran a test using pip3 install azure-cli==2.53.0 and it seems to be running my az postgres flexible-server fine.

just to confirm - apt-get install azure-cli=2.53.1-1~bookworm fixes it for me too ...

@terezbw
Copy link

terezbw commented Dec 13, 2023

I just ran a test using pip3 install azure-cli==2.53.0 and it seems to be running my az postgres flexible-server fine.

just to confirm - apt-get install azure-cli=2.53.1-1~bookworm fixes it for me too ...
The update command supports the --performance-tier option only starting from az cli 2.55
And the same error occurs there
DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last): File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute raise ex File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job result = cmd_copy(params) ^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__ return self.handler(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 200, in handler instance = custom_function(instance=instance, **custom_func_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py", line 279, in flexible_server_update_custom_func pg_arguments_validator(db_context, File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/rdbms/validators.py", line 309, in pg_arguments_validator list_location_capability_info = get_postgres_server_capability_info( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/rdbms/_flexible_server_location_capabilities_util.py", line 21, in get_postgres_server_capability_info return _postgres_parse_list_capability(list_server_capability_result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/rdbms/_flexible_server_location_capabilities_util.py", line 79, in _postgres_parse_list_capability tier_dict["supported_storageV2_size"] = int(storage_edition.supported_storage_mb[0].storage_size_mb // 1024) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^ IndexError: list index out of range

@Turniper
Copy link
Author

Interesting all of yall had to jump back to 2.53 while just going to 2.54 worked for us.

@felleg
Copy link

felleg commented Dec 14, 2023

Interesting indeed, I confirm that 2.54 wasn't working for me. 🤷🏻‍♂️ Good to know that reverting to 2.54 seems to work for someone!

@Xiad32
Copy link

Xiad32 commented Jan 4, 2024

Hi, I have a similar issue running this command:
az postgres flexible-server update --resource-group ****ResourceGroup --name *****-postgres-server -p Pp_12345678
I get the following error:

The command failed with an unexpected error. Here is the traceback:
list index out of range
Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 200, in handler
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/rdbms/flexible_server_custom_postgres.py", line 279, in flexible_server_update_custom_func
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/rdbms/validators.py", line 309, in pg_arguments_validator
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/rdbms/_flexible_server_location_capabilities_util.py", line 21, in get_postgres_server_capability_info
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/rdbms/_flexible_server_location_capabilities_util.py", line 79, in _postgres_parse_list_capability
IndexError: list index out of range
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Although running the show argument on the same resource responds fine:
az postgres flexible-server show --resource-group ****ResourceGroup --name ****-postgres-server

Using the older version, 2.53.1, as others suggested did work.

Should I open a new issue?

@HamzaAqel
Copy link

@Turniper the issue fixed in the latest version 2.56.0

@Turniper
Copy link
Author

Swapping all our pipelines back over to the latest version 2.56, after having one successful run. If they remain stable, will close this ticket.

@Turniper
Copy link
Author

Closing as resolved, appears to have been fixed in the normal course of business.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. PostgreSQL Service Attention This issue is responsible by Azure service team. Similar-Issue
Projects
None yet
Development

No branches or pull requests

8 participants