[PostgreSQL] BREAKING CHANGE: az postgres flexible-server create/update: Remove deprecated --cluster-option and update validation logic#33244
Conversation
…ate`: Remove deprecated `--cluster-option` and update validation logic
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Hi @nachoalonsoportillo, |
|
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 removes the deprecated --cluster-option flag from az postgres flexible-server create/update and shifts elastic-cluster detection to be implied by the presence of --node-count, updating CLI validation and scenario tests accordingly.
Changes:
- Remove deprecated
--cluster-optionargument and associated breaking-change registration. - Treat
--node-countpresence as the signal to create an elastic cluster (and gate--database-namebehind it). - Update elastic-cluster scenario tests to use
--node-countand add negative-path coverage for regular servers.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/postgresql/utils/validators.py |
Updates cluster-related validation to rely on cluster_size (--node-count) rather than --cluster-option. |
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_elastic_clusters.py |
Refactors scenario test flows to create/update clusters via --node-count and adds negative cases. |
src/azure-cli/azure/cli/command_modules/postgresql/commands/custom_commands.py |
Removes create_cluster plumbing and creates cluster payload only when cluster_size is provided. |
src/azure-cli/azure/cli/command_modules/postgresql/_params.py |
Removes --cluster-option parameter and updates help text/validators around --node-count and --database-name. |
src/azure-cli/azure/cli/command_modules/postgresql/_breaking_change.py |
Removes the deprecation registration for --cluster-option (and related import). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ble clusters - Updated the validation logic in the cluster validator to check for None explicitly, ensuring that the node count can only be specified for an elastic cluster. - Improved test assertions in the ElasticClustersMgmtScenarioTest to use assertEqual for location comparison, enhancing readability and accuracy.
| create_cluster=create_cluster, | ||
| password_auth=password_auth, microsoft_entra_auth=microsoft_entra_auth, | ||
| admin_name=admin_name, admin_id=admin_id, admin_type=admin_type,) | ||
| admin_name=admin_name, admin_id=admin_id, admin_type=admin_type, database_name=database_name) |
There was a problem hiding this comment.
Is passing database_name related to removing the deprecated cluster option? Should this be a separate PR and is it fixing an existing bug/exposing new functionality?
| sku_info = {k.lower(): v for k, v in sku_info.items()} | ||
| single_az = list_location_capability_info['single_az'] | ||
| geo_backup_supported = list_location_capability_info['geo_backup_supported'] | ||
| _cluster_validator(create_cluster, cluster_size, auto_grow, version, instance) |
There was a problem hiding this comment.
Why is auto_grow and version removed from the validation?
| if (create_cluster and create_cluster.lower() == 'elasticcluster') or \ | ||
| (instance and instance.cluster and instance.cluster.cluster_size > 0): | ||
| if instance is None and version != '17': | ||
| raise ValidationError('Elastic cluster is only supported for PostgreSQL version 17.') |
There was a problem hiding this comment.
It is supported for version 17 and up. If we get sensible messages from the control plane then we can indeed drop CLI validation.
…to remove deprecated `--cluster-option` references
Related command
az postgres flexible-server create/updateDescription
--cluster-optionargument is deprecated. For thecreatecommand, the presence of--node-countargument implies elastic cluster, and its absence implies regular (non cluster) flexible server.Testing Guide
Adjusted existing tests to this new functionality.
History Notes
This 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.