Rework on glance oscheck

Currently the glance api check is giving tracebacks instead
of meaningful errors. Couple of changes are made to address the issue.

Change-Id: I6c71edb528677a4fde0c97eb3d465600b689d1bd
Closes-Bug: #1784651
This commit is contained in:
Nagasai Vinaykumar Kapalavai 2018-07-11 16:12:32 +00:00
parent 965579723c
commit 4130916b79
2 changed files with 3 additions and 6 deletions

View File

@ -40,14 +40,11 @@ def _check_glance_api():
utils.critical(str(ex))
elapsed, images = utils.timeit(images_list)
if not images:
utils.critical("Unable to contact Glance API.")
if elapsed > options.critical:
if images and elapsed > options.critical:
utils.critical("Get images took more than %d seconds, "
"it's too long.|response_time=%d" %
(options.critical, elapsed))
elif elapsed > options.warning:
elif images and elapsed > options.warning:
utils.warning("Get images took more than %d seconds, "
"it's too long.|response_time=%d" %
(options.warning, elapsed))

View File

@ -181,7 +181,7 @@ class Glance(object):
(options, args) = self.glance.parser.parse_known_args(self.base_argv)
if options.help:
options.command = None
self.glance.do_help(options)
self.glance.do_help(options, self.glance.parser)
sys.exit(2)
api_version = (
getattr(options, 'os_image_api_version', api_version) or