summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorridhi.j.shah@gmail.com <ridhi.j.shah@gmail.com>2014-08-22 14:59:25 -0500
committerNikhil Manchanda <SlickNik@gmail.com>2014-09-01 11:45:18 -0700
commit33c76fab16b80f32a04f83e1653d4f809c22d3bd (patch)
treecf393ce916ea9221f6da8429d5ef3c0b9aa7e249
parent522eb72a3e7e60b467e3652d119564f1c1a7f456 (diff)
downloadpython-troveclient-33c76fab16b80f32a04f83e1653d4f809c22d3bd.tar.gz
Add a drop config-grp command in update instance1.0.6
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
-rw-r--r--troveclient/v1/instances.py7
-rw-r--r--troveclient/v1/shell.py9
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',