Merge "Remove extra parameter 'backup' in backup-create"
This commit is contained in:
commit
a05be72736
@ -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
|
||||
|
@ -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')
|
||||
|
@ -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:
|
||||
|
@ -1051,30 +1051,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>',
|
||||
|
Loading…
x
Reference in New Issue
Block a user