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:
parent
965579723c
commit
4130916b79
|
@ -40,14 +40,11 @@ def _check_glance_api():
|
||||||
utils.critical(str(ex))
|
utils.critical(str(ex))
|
||||||
|
|
||||||
elapsed, images = utils.timeit(images_list)
|
elapsed, images = utils.timeit(images_list)
|
||||||
if not images:
|
if images and elapsed > options.critical:
|
||||||
utils.critical("Unable to contact Glance API.")
|
|
||||||
|
|
||||||
if elapsed > options.critical:
|
|
||||||
utils.critical("Get images took more than %d seconds, "
|
utils.critical("Get images took more than %d seconds, "
|
||||||
"it's too long.|response_time=%d" %
|
"it's too long.|response_time=%d" %
|
||||||
(options.critical, elapsed))
|
(options.critical, elapsed))
|
||||||
elif elapsed > options.warning:
|
elif images and elapsed > options.warning:
|
||||||
utils.warning("Get images took more than %d seconds, "
|
utils.warning("Get images took more than %d seconds, "
|
||||||
"it's too long.|response_time=%d" %
|
"it's too long.|response_time=%d" %
|
||||||
(options.warning, elapsed))
|
(options.warning, elapsed))
|
||||||
|
|
|
@ -181,7 +181,7 @@ class Glance(object):
|
||||||
(options, args) = self.glance.parser.parse_known_args(self.base_argv)
|
(options, args) = self.glance.parser.parse_known_args(self.base_argv)
|
||||||
if options.help:
|
if options.help:
|
||||||
options.command = None
|
options.command = None
|
||||||
self.glance.do_help(options)
|
self.glance.do_help(options, self.glance.parser)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
api_version = (
|
api_version = (
|
||||||
getattr(options, 'os_image_api_version', api_version) or
|
getattr(options, 'os_image_api_version', api_version) or
|
||||||
|
|
Loading…
Reference in New Issue