Remove extra parameter 'backup' in backup-create

The parameter 'backup' in backup-create is never read by our Trove API[1], so
I guess it's a extra key argument for history reason. In addition, the
'backup-copy' subcommand should be removed as well because it does not
support in current Trove API.

[1] https://github.com/openstack/trove/blob/master/trove/backup/service.py#L61-L77

Change-Id: I33d439e0037efd4573eeae186758fd778ba5c514
This commit is contained in:
int32bit 2017-08-22 09:47:54 +08:00
parent a397f72da4
commit 457cefa90d
4 changed files with 2 additions and 47 deletions

View File

@ -96,15 +96,6 @@ class BackupManagerTest(testtools.TestCase):
self.backups.create(**args)
create_mock.assert_called_with('/backups', body, 'backup')
def test_copy(self):
create_mock = mock.Mock()
self.backups._create = create_mock
args = {'name': 'test_backup', 'instance': 'foo',
'backup': '1', 'incremental': False}
body = {'backup': args}
self.backups.create(**args)
create_mock.assert_called_with('/backups', body, 'backup')
def test_list(self):
page_mock = mock.Mock()
self.backups._paginated = page_mock

View File

@ -824,16 +824,6 @@ class ShellTest(utils.TestCase):
'incremental': False
}})
def test_backup_copy(self):
self.run_command('backup-copy new_bkp bk-1234')
self.assert_called_anytime(
'POST', '/backups',
{'backup': {
'name': 'new_bkp',
'incremental': False,
'backup': {'region': None, 'id': 'bk-1234'}
}})
def test_database_list(self):
self.run_command('database-list 1234')
self.assert_called('GET', '/instances/1234/databases')

View File

@ -71,8 +71,8 @@ class Backups(base.ManagerWithFind):
return self._paginated("/backups", "backups", limit, marker,
query_strings)
def create(self, name, instance, description=None, parent_id=None,
backup=None, incremental=False):
def create(self, name, instance, description=None,
parent_id=None, incremental=False):
"""Create a new backup from the given instance.
:param name: name for backup.
@ -92,8 +92,6 @@ class Backups(base.ManagerWithFind):
if instance:
body['backup']['instance'] = base.getid(instance)
if backup:
body["backup"]['backup'] = backup
if description:
body['backup']['description'] = description
if parent_id:

View File

@ -1048,30 +1048,6 @@ def do_backup_create(cs, args):
_print_object(backup)
@utils.arg('name', metavar='<name>', help=_('Name of the backup.'))
@utils.arg('backup', metavar='<backup>',
help=_('Backup ID of the source backup.'),
default=None)
@utils.arg('--region', metavar='<region>', default=None,
# help=_('Region where the source backup resides.'))
help=argparse.SUPPRESS)
@utils.arg('--description', metavar='<description>',
default=None,
help=_('An optional description for the backup.'))
@utils.service_type('database')
def do_backup_copy(cs, args):
"""Creates a backup from another backup."""
if args.backup:
backup_ref = {"id": args.backup,
"region": args.region}
else:
backup_ref = None
backup = cs.backups.create(args.name, instance=None,
description=args.description,
parent_id=None, backup=backup_ref,)
_print_object(backup)
@utils.arg('instance', metavar='<instance>',
help=_('ID or name of the instance.'))
@utils.arg('pattern', metavar='<pattern>',