Add error checking around host service checking
If the host provided doesn't exist in the table, nova-manage will spit a traceback out, which isn't very friendly. This patch copies the same code used in other nova-manage commands to wrap the offending call. Change-Id: I606b22f0cea523809fcfa34f5b61ce70ba8d6152
This commit is contained in:
parent
494eccd7de
commit
263672b032
@ -797,8 +797,12 @@ class ServiceCommands(object):
|
||||
:param host: hostname.
|
||||
|
||||
"""
|
||||
result = self._show_host_resources(context.get_admin_context(),
|
||||
host=host)
|
||||
try:
|
||||
result = self._show_host_resources(context.get_admin_context(),
|
||||
host=host)
|
||||
except exception.NovaException as ex:
|
||||
print (_("error: %s") % ex)
|
||||
return 2
|
||||
|
||||
if not isinstance(result, dict):
|
||||
print(_('An unexpected error has occurred.'))
|
||||
|
Loading…
Reference in New Issue
Block a user