Merge ""nova boot" should not log an error if subsidiary commands fail"
This commit is contained in:
commit
1a7f84cb46
|
@ -55,6 +55,11 @@ class CommandError(ClientException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ResourceNotFound(ClientException):
|
||||||
|
"""Error in getting the resource."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AuthorizationFailure(ClientException):
|
class AuthorizationFailure(ClientException):
|
||||||
"""Cannot authorize API client."""
|
"""Cannot authorize API client."""
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -89,15 +89,15 @@ class FindResourceTestCase(test_utils.TestCase):
|
||||||
|
|
||||||
def test_find_none(self):
|
def test_find_none(self):
|
||||||
"""Test a few non-valid inputs."""
|
"""Test a few non-valid inputs."""
|
||||||
self.assertRaises(exceptions.CommandError,
|
self.assertRaises(exceptions.ResourceNotFound,
|
||||||
utils.find_resource,
|
utils.find_resource,
|
||||||
self.manager,
|
self.manager,
|
||||||
'asdf')
|
'asdf')
|
||||||
self.assertRaises(exceptions.CommandError,
|
self.assertRaises(exceptions.ResourceNotFound,
|
||||||
utils.find_resource,
|
utils.find_resource,
|
||||||
self.manager,
|
self.manager,
|
||||||
None)
|
None)
|
||||||
self.assertRaises(exceptions.CommandError,
|
self.assertRaises(exceptions.ResourceNotFound,
|
||||||
utils.find_resource,
|
utils.find_resource,
|
||||||
self.manager,
|
self.manager,
|
||||||
{})
|
{})
|
||||||
|
|
|
@ -953,7 +953,7 @@ class ShellTest(utils.TestCase):
|
||||||
self.assert_called('GET', '/flavors/1', pos=-1)
|
self.assert_called('GET', '/flavors/1', pos=-1)
|
||||||
|
|
||||||
def test_show_bad_id(self):
|
def test_show_bad_id(self):
|
||||||
self.assertRaises(exceptions.CommandError,
|
self.assertRaises(exceptions.ResourceNotFound,
|
||||||
self.run_command, 'show xxx')
|
self.run_command, 'show xxx')
|
||||||
|
|
||||||
@mock.patch('novaclient.v1_1.shell.utils.print_dict')
|
@mock.patch('novaclient.v1_1.shell.utils.print_dict')
|
||||||
|
|
|
@ -241,7 +241,7 @@ def find_resource(manager, name_or_id, **find_args):
|
||||||
msg = _("No %(class)s with a name or ID of '%(name)s' exists.") % \
|
msg = _("No %(class)s with a name or ID of '%(name)s' exists.") % \
|
||||||
{'class': manager.resource_class.__name__.lower(),
|
{'class': manager.resource_class.__name__.lower(),
|
||||||
'name': name_or_id}
|
'name': name_or_id}
|
||||||
raise exceptions.CommandError(msg)
|
raise exceptions.ResourceNotFound(msg)
|
||||||
except exceptions.NoUniqueMatch:
|
except exceptions.NoUniqueMatch:
|
||||||
msg = (_("Multiple %(class)s matches found for '%(name)s', use an ID "
|
msg = (_("Multiple %(class)s matches found for '%(name)s', use an ID "
|
||||||
"to be more specific.") %
|
"to be more specific.") %
|
||||||
|
|
Loading…
Reference in New Issue