class HorizonMixin(object): def setUp(self): super(HorizonMixin, self).setUp() self.horizon = Horizon('https://localhost:8000', 'firefox') self.horizon.open_page_main() def tearDown(self): self.horizon.quit() super(HorizonMixin, self).tearDown()
def get_data(self, request, context, *args, **kwargs): has_murano = False try: Horizon.get_dashboard('murano') has_murano = True except Exception: pass regex = re.compile('(\d+\.\d+\.\d+)-?(.*)') heat_version = None heat_release = None try: info = api.heat.heatclient( request).build_info.build_info()['engine']['revision'] match = regex.match(info) if match: heat_version = match.group(1) heat_release = match.group(0) except Exception: pass horizon_version = "8.0.2" horizon_release_version = "8.0.2.dev30" heat_version = getattr(settings, 'APP_CATALOG_HEAT_VERSION', heat_version) heat_release = getattr(settings, 'APP_CATALOG_HEAT_RELEASE', heat_release) murano_version = getattr(settings, 'APP_CATALOG_MURANO_VERSION', None) murano_release = getattr(settings, 'APP_CATALOG_MURANO_RELEASE', None) app_catalog_settings = { 'HEAT_VERSION': { 'VER': heat_version, 'REL': heat_release }, 'HAS_MURANO': has_murano, 'MURANO_VERSION': { 'VER': murano_version, 'REL': murano_release }, 'HORIZON_VERSION': { 'VER': horizon_version, 'REL': horizon_release_version }, 'APP_CATALOG_VERSION': { 'VER': acvi.version_string(), 'REL': acvi.release_string() }, 'APP_CATALOG_URL': getattr(settings, 'APP_CATALOG_URL', '//apps.openstack.org') } context['APP_CATALOG_SETTINGS'] = json.dumps(app_catalog_settings) return context
def get_data(self, request, context, *args, **kwargs): has_murano = False try: Horizon.get_dashboard('murano') has_murano = True except Exception: pass regex = re.compile('(\d+\.\d+\.\d+)-?(.*)') heat_version = None heat_release = None try: info = api.heat.heatclient( request).build_info.build_info()['engine']['revision'] match = regex.match(info) if match: heat_version = match.group(1) heat_release = match.group(0) except Exception: pass heat_version = getattr(settings, 'APP_CATALOG_HEAT_VERSION', heat_version) heat_release = getattr(settings, 'APP_CATALOG_HEAT_RELEASE', heat_release) murano_version = getattr(settings, 'APP_CATALOG_MURANO_VERSION', None) murano_release = getattr(settings, 'APP_CATALOG_MURANO_RELEASE', None) app_catalog_settings = { 'HEAT_VERSION': { 'VER': heat_version, 'REL': heat_release }, 'HAS_MURANO': has_murano, 'MURANO_VERSION': { 'VER': murano_version, 'REL': murano_release }, 'HORIZON_VERSION': { 'VER': hvi.version_string(), 'REL': hvi.release_string() }, 'APP_CATALOG_VERSION': { 'VER': acvi.version_string(), 'REL': acvi.release_string() }, 'APP_CATALOG_URL': getattr(settings, 'APP_CATALOG_URL', '//apps.openstack.org') } context['APP_CATALOG_SETTINGS'] = json.dumps(app_catalog_settings) return context
def unregister(cls, panel): """ Unregisters a :class:`~horizon.Panel` from this dashboard. """ from horizon import Horizon return Horizon.unregister_panel(cls, panel)
def register(cls, panel): """ Registers a :class:`~horizon.Panel` with this dashboard. """ from horizon import Horizon return Horizon.register_panel(cls, panel)
def horizon(): horizon = Horizon('http:/localhost:8000', 'firefox') horizon.open_page_main() yield horizon horizon.quit()
def setUp(self): super(HorizonMixin, self).setUp() self.horizon = Horizon('https://localhost:8000', 'firefox') self.horizon.open_page_main()