From 33c76fab16b80f32a04f83e1653d4f809c22d3bd Mon Sep 17 00:00:00 2001 From: "ridhi.j.shah@gmail.com" Date: Fri, 22 Aug 2014 14:59:25 -0500 Subject: 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 --- troveclient/v1/instances.py | 7 ++++++- troveclient/v1/shell.py | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/troveclient/v1/instances.py b/troveclient/v1/instances.py index ab33686..f667654 100644 --- a/troveclient/v1/instances.py +++ b/troveclient/v1/instances.py @@ -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: diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py index 595f4b5..a33b145 100644 --- a/troveclient/v1/shell.py +++ b/troveclient/v1/shell.py @@ -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', -- cgit v1.2.1