diff options
| author | wangyao <wangyao@cmss.chinamobile.com> | 2018-07-16 17:39:23 +0800 |
|---|---|---|
| committer | wangyao <wangyao@cmss.chinamobile.com> | 2018-07-17 16:20:58 +0800 |
| commit | 83eb65cc84c3de0df477486e2adf622e0ddfa2e9 (patch) | |
| tree | 5c34e2d4e55f941953c8d2da787cbc27ed920055 /troveclient | |
| parent | 77f96476449e2418a64cbb508be68ccd77b38e79 (diff) | |
| download | python-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
Diffstat (limited to 'troveclient')
| -rw-r--r-- | troveclient/osc/v1/database_backups.py | 19 | ||||
| -rw-r--r-- | troveclient/tests/osc/v1/test_database_backups.py | 15 |
2 files changed, 34 insertions, 0 deletions
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) |
