Skip to content

[PostgreSQL] BREAKING CHANGE: az postgres flexible-server create/update: Remove deprecated --cluster-option and update validation logic#33244

Open
nachoalonsoportillo wants to merge 3 commits intoAzure:devfrom
nachoalonsoportillo:cluster-option-breaking-change-implementation
Open

[PostgreSQL] BREAKING CHANGE: az postgres flexible-server create/update: Remove deprecated --cluster-option and update validation logic#33244
nachoalonsoportillo wants to merge 3 commits intoAzure:devfrom
nachoalonsoportillo:cluster-option-breaking-change-implementation

Conversation

@nachoalonsoportillo
Copy link
Copy Markdown
Member

Related command

az postgres flexible-server create/update

Description

--cluster-option argument is deprecated. For the create command, the presence of --node-count argument 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.

…ate`: Remove deprecated `--cluster-option` and update validation logic
Copilot AI review requested due to automatic review settings April 22, 2026 12:32
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @nachoalonsoportillo,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Breaking Change Starting...

Thanks for your contribution!

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 22, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-option argument and associated breaking-change registration.
  • Treat --node-count presence as the signal to create an elastic cluster (and gate --database-name behind it).
  • Update elastic-cluster scenario tests to use --node-count and 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.

Comment thread src/azure-cli/azure/cli/command_modules/postgresql/commands/custom_commands.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/postgresql/utils/validators.py Outdated
…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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants