Add a drop config-grp command in update instance
As per the current code in the client, there is no option to detach the configuration group of the instance. This change gives a user the option to explicitly drop the config group of the instance as part of the instance update call. Change-Id: I7defd110549df87afd267d3ebe998904ff6b7483 Closes-Bug: 1359359
This commit is contained in:

committed by
Nikhil Manchanda

parent
522eb72a3e
commit
33c76fab16
@@ -94,11 +94,16 @@ class Instances(base.ManagerWithFind):
|
|||||||
common.check_for_exceptions(resp, body, url)
|
common.check_for_exceptions(resp, body, url)
|
||||||
|
|
||||||
def edit(self, instance_id, configuration=None, name=None,
|
def edit(self, instance_id, configuration=None, name=None,
|
||||||
detach_replica_source=False):
|
detach_replica_source=False, remove_configuration=False):
|
||||||
body = {
|
body = {
|
||||||
"instance": {
|
"instance": {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if configuration and remove_configuration:
|
||||||
|
raise Exception("Cannot attach and detach configuration "
|
||||||
|
"simultaneosly.")
|
||||||
|
if remove_configuration:
|
||||||
|
body["instance"]["configuration"] = None
|
||||||
if configuration is not None:
|
if configuration is not None:
|
||||||
body["instance"]["configuration"] = configuration
|
body["instance"]["configuration"] = configuration
|
||||||
if name is not None:
|
if name is not None:
|
||||||
|
@@ -184,12 +184,17 @@ def do_delete(cs, args):
|
|||||||
dest='detach_replica_source',
|
dest='detach_replica_source',
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False,
|
default=False,
|
||||||
help='Detach the replica instance from its replication source .')
|
help='Detach the replica instance from its replication source.')
|
||||||
|
@utils.arg('--remove_configuration',
|
||||||
|
dest='remove_configuration',
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help='Drops the current configuration reference.')
|
||||||
@utils.service_type('database')
|
@utils.service_type('database')
|
||||||
def do_update(cs, args):
|
def do_update(cs, args):
|
||||||
"""Updates an instance: Edits name, configuration, or replica source."""
|
"""Updates an instance: Edits name, configuration, or replica source."""
|
||||||
cs.instances.edit(args.instance, args.configuration, args.name,
|
cs.instances.edit(args.instance, args.configuration, args.name,
|
||||||
args.detach_replica_source)
|
args.detach_replica_source, args.remove_configuration)
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('name',
|
@utils.arg('name',
|
||||||
|
Reference in New Issue
Block a user