From 7bb9d077e350175eb21992210463c93f438264ca Mon Sep 17 00:00:00 2001 From: Nikita Konovalov Date: Thu, 27 Mar 2014 18:38:35 +0400 Subject: [PATCH] Horizon compatibility fix Support horizon installed from packages with no version info. Closes-Bug: #1298433 Change-Id: I6ab1c340528dbc73baede686aaa937fa098fd281 --- saharadashboard/utils/compatibility.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/saharadashboard/utils/compatibility.py b/saharadashboard/utils/compatibility.py index dde7485f..51db2a78 100644 --- a/saharadashboard/utils/compatibility.py +++ b/saharadashboard/utils/compatibility.py @@ -22,16 +22,25 @@ Folsom is the oldest recognizable release. def get_dashboard_release(): """Return release codename of currently running Dashboard.""" + import horizon.version if hasattr(horizon.version, 'HORIZON_VERSION'): return 'folsom' if hasattr(horizon.version, "version_info"): - if "2013.2" in horizon.version.version_info.version_string(): - return "havana" + try: + version_string = horizon.version.version_info.version_string() + if "2013.2" in version_string: + return "havana" - return 'icehouse' + except Exception: + # This may happen if Horizon is installed using packages which do + # not contain any information on release. Assuming that it is the + # latest release. + pass + + return _get_latest_release() def _is_folsom(): @@ -42,6 +51,10 @@ def _is_havana(): return get_dashboard_release() == 'havana' +def _get_latest_release(): + return 'icehouse' + + def convert_url(link): """Expect grizzly url and convert it to folsom if needed