Fix KeyError for HORIZON_CONFIG['plugins'] in plugin UT

HORIZON_CONFIG['plugins'] does not always exist.
It breaks unit tests of some horizon plugins like designate-dashboard.

Change-Id: I23aae10a7e63494c1c9f656b47becd2f067c9058
Closes-Bug: #1702889
This commit is contained in:
Akihiro Motoki 2017-07-07 11:33:40 +00:00
parent e9e1605c3d
commit f50cce4c1c

View File

@ -107,6 +107,6 @@ def get_js_catalog(conf):
# so we exclude them from the js_catalog
js_catalog = ['horizon', 'openstack_dashboard']
regex = re.compile(r'^openstack_dashboard')
all_plugins = conf.HORIZON_CONFIG['plugins']
all_plugins = conf.HORIZON_CONFIG.get('plugins', [])
js_catalog.extend(p for p in all_plugins if not regex.search(p))
return '+'.join(js_catalog)