[POSTGRESQL] az postgres flexible-server create: Block SSDv2 creation for PG version < 14#33119
Conversation
…on for PG version < 14
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull request overview
This PR updates PostgreSQL flexible server argument validation to prevent using Premium SSD v2 storage (PremiumV2_LRS) when creating servers on PostgreSQL versions earlier than 14.
Changes:
- Passes
versioninto the storage-type validator. - Adds a version gate that blocks
PremiumV2_LRScreation for PG major versions< 14.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if version and int(version) < 14: | ||
| raise CLIError('Storage type PremiumV2_LRS is only supported for PostgreSQL version 14 and above.') |
There was a problem hiding this comment.
int(version) is evaluated before pg_version_validator runs (and before any format validation), so invalid inputs like --version foo with --storage-type PremiumV2_LRS will raise an unhandled ValueError instead of a clean CLI validation error. Consider avoiding int() here (e.g., compare against explicit supported majors like ('11','12','13') or safely parse version.split('.')[0] inside a try/except that raises CLIError), or move pg_version_validator(...) earlier so version is validated before this check.
| if version and int(version) < 14: | |
| raise CLIError('Storage type PremiumV2_LRS is only supported for PostgreSQL version 14 and above.') | |
| if version: | |
| try: | |
| # Accept versions like "14" or "14.x" by using the major component only. | |
| major_version = int(str(version).split('.')[0]) | |
| except (ValueError, TypeError): | |
| raise CLIError('Invalid PostgreSQL version "{}".'.format(version)) | |
| if major_version < 14: | |
| raise CLIError('Storage type PremiumV2_LRS is only supported for PostgreSQL version 14 and above.') |
| if is_create_ssdv2: | ||
| if version and int(version) < 14: | ||
| raise CLIError('Storage type PremiumV2_LRS is only supported for PostgreSQL version 14 and above.') | ||
| if supported_storageV2_size is None: |
There was a problem hiding this comment.
This change introduces new user-facing validation behavior (blocking PremiumV2_LRS for PG < 14) but there’s no test ensuring the create command fails with the expected message for versions 11/12/13. Adding a scenario test case (similar to existing SSDv2 tests) would prevent regressions and ensure the validator is exercised.
Related command
az postgres flexible-server create
Description
Block SSDv2 creation for PG version < 14
Testing Guide
History Notes
[POSTGRESQL]
az postgres flexible-server create: Block SSDv2 creation for PG version < 14This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.