From 263672b032b0d3b6e67f6cff5020ab60f7f272f9 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 31 Jul 2013 10:38:37 -0700 Subject: [PATCH] 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 --- nova/cmd/manage.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index 2b1396dfcf07..fb5f1ce57b33 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -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.'))