summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwangyao <wangyao@cmss.chinamobile.com>2018-07-16 17:39:23 +0800
committerwangyao <wangyao@cmss.chinamobile.com>2018-07-17 16:20:58 +0800
commit83eb65cc84c3de0df477486e2adf622e0ddfa2e9 (patch)
tree5c34e2d4e55f941953c8d2da787cbc27ed920055
parent77f96476449e2418a64cbb508be68ccd77b38e79 (diff)
downloadpython-troveclient-83eb65cc84c3de0df477486e2adf622e0ddfa2e9.tar.gz
Add execution-delete to OSC
This change adds database support to the python-openstackclient project for the execution-delete command. The trove command execution-delete is now: openstack database backup execution delete Change-Id: I9934a047d48daed53567b59bb51a2eab4d6e37b5 Partially-Implements: blueprint trove-support-in-python-openstackclient
-rw-r--r--releasenotes/notes/add-execution-delete-to-osc-013b4bf00a1cb8ff.yaml5
-rw-r--r--setup.cfg1
-rw-r--r--troveclient/osc/v1/database_backups.py19
-rw-r--r--troveclient/tests/osc/v1/test_database_backups.py15
4 files changed, 40 insertions, 0 deletions
diff --git a/releasenotes/notes/add-execution-delete-to-osc-013b4bf00a1cb8ff.yaml b/releasenotes/notes/add-execution-delete-to-osc-013b4bf00a1cb8ff.yaml
new file mode 100644
index 0000000..96ff826
--- /dev/null
+++ b/releasenotes/notes/add-execution-delete-to-osc-013b4bf00a1cb8ff.yaml
@@ -0,0 +1,5 @@
+---
+features:
+ - The command ``trove execution-delete`` is now available to use in
+ the python-openstackclient CLI as ``openstack database backup
+ execution delete``
diff --git a/setup.cfg b/setup.cfg
index ced5547..a033b14 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -32,6 +32,7 @@ openstack.cli.extension =
openstack.database.v1 =
database_backup_create= troveclient.osc.v1.database_backups:CreateDatabaseBackup
database_backup_delete = troveclient.osc.v1.database_backups:DeleteDatabaseBackup
+ database_backup_execution_delete = troveclient.osc.v1.database_backups:DeleteDatabaseBackupExecution
database_backup_list = troveclient.osc.v1.database_backups:ListDatabaseBackups
database_backup_list_instance = troveclient.osc.v1.database_backups:ListDatabaseInstanceBackups
database_backup_show = troveclient.osc.v1.database_backups:ShowDatabaseBackup
diff --git a/troveclient/osc/v1/database_backups.py b/troveclient/osc/v1/database_backups.py
index 8b3e973..8f2b160 100644
--- a/troveclient/osc/v1/database_backups.py
+++ b/troveclient/osc/v1/database_backups.py
@@ -220,3 +220,22 @@ class CreateDatabaseBackup(command.ShowOne):
incremental=parsed_args.incremental)
backup = set_attributes_for_print_detail(backup)
return zip(*sorted(six.iteritems(backup)))
+
+
+class DeleteDatabaseBackupExecution(command.Command):
+
+ _description = _("Deletes an execution.")
+
+ def get_parser(self, prog_name):
+ parser = super(DeleteDatabaseBackupExecution, self).get_parser(
+ prog_name)
+ parser.add_argument(
+ 'execution',
+ metavar='<execution>',
+ help=_('ID of the execution to delete.')
+ )
+ return parser
+
+ def take_action(self, parsed_args):
+ database_backups = self.app.client_manager.database.backups
+ database_backups.execution_delete(parsed_args.execution)
diff --git a/troveclient/tests/osc/v1/test_database_backups.py b/troveclient/tests/osc/v1/test_database_backups.py
index 4b1d10a..bbcaefe 100644
--- a/troveclient/tests/osc/v1/test_database_backups.py
+++ b/troveclient/tests/osc/v1/test_database_backups.py
@@ -206,3 +206,18 @@ class TestBackupCreate(TestBackups):
description='backup 1234',
parent_id='1234-1',
incremental=True)
+
+
+class TestDatabaseBackupExecutionDelete(TestBackups):
+
+ def setUp(self):
+ super(TestDatabaseBackupExecutionDelete, self).setUp()
+ self.cmd = database_backups.DeleteDatabaseBackupExecution(
+ self.app, None)
+
+ def test_execution_delete(self):
+ args = ['execution']
+ parsed_args = self.check_parser(self.cmd, args, [])
+ result = self.cmd.take_action(parsed_args)
+ self.backup_client.execution_delete.assert_called_with('execution')
+ self.assertIsNone(result)