Merge "Remove extra parameter 'backup' in backup-create"
This commit is contained in:
@@ -96,15 +96,6 @@ class BackupManagerTest(testtools.TestCase):
|
|||||||
self.backups.create(**args)
|
self.backups.create(**args)
|
||||||
create_mock.assert_called_with('/backups', body, 'backup')
|
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):
|
def test_list(self):
|
||||||
page_mock = mock.Mock()
|
page_mock = mock.Mock()
|
||||||
self.backups._paginated = page_mock
|
self.backups._paginated = page_mock
|
||||||
|
@@ -824,16 +824,6 @@ class ShellTest(utils.TestCase):
|
|||||||
'incremental': False
|
'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):
|
def test_database_list(self):
|
||||||
self.run_command('database-list 1234')
|
self.run_command('database-list 1234')
|
||||||
self.assert_called('GET', '/instances/1234/databases')
|
self.assert_called('GET', '/instances/1234/databases')
|
||||||
|
@@ -71,8 +71,8 @@ class Backups(base.ManagerWithFind):
|
|||||||
return self._paginated("/backups", "backups", limit, marker,
|
return self._paginated("/backups", "backups", limit, marker,
|
||||||
query_strings)
|
query_strings)
|
||||||
|
|
||||||
def create(self, name, instance, description=None, parent_id=None,
|
def create(self, name, instance, description=None,
|
||||||
backup=None, incremental=False):
|
parent_id=None, incremental=False):
|
||||||
"""Create a new backup from the given instance.
|
"""Create a new backup from the given instance.
|
||||||
|
|
||||||
:param name: name for backup.
|
:param name: name for backup.
|
||||||
@@ -92,8 +92,6 @@ class Backups(base.ManagerWithFind):
|
|||||||
|
|
||||||
if instance:
|
if instance:
|
||||||
body['backup']['instance'] = base.getid(instance)
|
body['backup']['instance'] = base.getid(instance)
|
||||||
if backup:
|
|
||||||
body["backup"]['backup'] = backup
|
|
||||||
if description:
|
if description:
|
||||||
body['backup']['description'] = description
|
body['backup']['description'] = description
|
||||||
if parent_id:
|
if parent_id:
|
||||||
|
@@ -1051,30 +1051,6 @@ def do_backup_create(cs, args):
|
|||||||
_print_object(backup)
|
_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>',
|
@utils.arg('instance', metavar='<instance>',
|
||||||
help=_('ID or name of the instance.'))
|
help=_('ID or name of the instance.'))
|
||||||
@utils.arg('pattern', metavar='<pattern>',
|
@utils.arg('pattern', metavar='<pattern>',
|
||||||
|
Reference in New Issue
Block a user