Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# --------------------------------------------------------------------------------------------

from azure.cli.core.breaking_change import register_command_group_deprecate, register_default_value_breaking_change, \
register_argument_deprecate, register_other_breaking_change, register_logic_breaking_change, \
register_command_deprecate
register_argument_deprecate, register_other_breaking_change, register_logic_breaking_change


register_logic_breaking_change('postgres flexible-server create', 'Update default value of "--sku-name"',
Expand All @@ -17,8 +16,6 @@
register_argument_deprecate('postgres flexible-server create', '--active-directory-auth', '--microsoft-entra-auth')
register_argument_deprecate('postgres flexible-server update', '--active-directory-auth', '--microsoft-entra-auth')
register_command_group_deprecate('postgres flexible-server ad-admin', redirect='microsoft-entra-admin')
register_command_deprecate('postgres flexible-server replica stop-replication',
redirect='postgres flexible-server replica promote', hide=True)
register_other_breaking_change('postgres flexible-server update',
message='User confirmation will be needed for compute and storage updates '
'that trigger a restart of the server.')
Original file line number Diff line number Diff line change
Expand Up @@ -845,14 +845,6 @@
text: az postgres flexible-server replica list -g testGroup -n testserver
"""

helps['postgres flexible-server replica stop-replication'] = """
type: command
short-summary: Stop replication to a read replica and make it a read/write server.
examples:
- name: Stop replication to 'testreplicaserver' and make it a read/write server.
text: az postgres flexible-server replica stop-replication -g testGroup -n testreplicaserver
"""

helps['postgres flexible-server replica promote'] = """
type: command
short-summary: Stop replication of a read replica and promote it to an independent server or as a primary server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ def load_flexibleserver_command_table(self, _):
custom_command_type=flexible_servers_custom_postgres,
client_factory=cf_postgres_flexible_servers) as g:
g.custom_command('create', 'flexible_replica_create', supports_no_wait=True)
g.custom_command('stop-replication', 'flexible_replica_stop', confirmation=True)
g.custom_command('promote', 'flexible_replica_promote', confirmation=True)

with self.command_group('postgres flexible-server identity', postgres_flexible_servers_sdk,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -804,29 +804,6 @@ def flexible_server_revivedropped(cmd, client, resource_group_name, server_name,
return sdk_no_wait(no_wait, client.begin_create, resource_group_name, server_name, parameters)


def flexible_replica_stop(cmd, client, resource_group_name, server_name):
validate_resource_group(resource_group_name)
validate_citus_cluster(cmd, resource_group_name, server_name)

try:
server_object = client.get(resource_group_name, server_name)
except Exception as e:
raise ResourceNotFoundError(e)

if server_object.replica.role is not None and "replica" not in server_object.replica.role.lower():
raise CLIError('Server {} is not a replica server.'.format(server_name))

params = postgresql_flexibleservers.models.ServerForUpdate(
replica=postgresql_flexibleservers.models.Replica(
role='None',
promote_mode='standalone',
promote_option='planned'
)
)

return client.begin_update(resource_group_name, server_name, params)


def flexible_replica_promote(cmd, client, resource_group_name, server_name, promote_mode='standalone', promote_option='planned'):
validate_resource_group(resource_group_name)
validate_citus_cluster(cmd, resource_group_name, server_name)
Expand Down
Loading
Loading