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:
ridhi.j.shah@gmail.com 2014-08-22 14:59:25 -05:00 committed by Nikhil Manchanda
parent 522eb72a3e
commit 33c76fab16
2 changed files with 13 additions and 3 deletions

View File

@ -94,11 +94,16 @@ class Instances(base.ManagerWithFind):
common.check_for_exceptions(resp, body, url)
def edit(self, instance_id, configuration=None, name=None,
detach_replica_source=False):
detach_replica_source=False, remove_configuration=False):
body = {
"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:
body["instance"]["configuration"] = configuration
if name is not None:

View File

@ -184,12 +184,17 @@ def do_delete(cs, args):
dest='detach_replica_source',
action="store_true",
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')
def do_update(cs, args):
"""Updates an instance: Edits name, configuration, or replica source."""
cs.instances.edit(args.instance, args.configuration, args.name,
args.detach_replica_source)
args.detach_replica_source, args.remove_configuration)
@utils.arg('name',