<s> from django . utils . translation import ugettext_lazy as _ <EOL> from horizon import exceptions <EOL> from horizon import tabs <EOL> from openstack_dashboard . api import base <EOL> from openstack_dashboard . api import cinder <EOL> from openstack_dashboard . api import keystone <EOL> from openstack_dashboard . api import neutron <EOL> from openstack_dashboard . api import nova <EOL> from openstack_dashboard . dashboards . admin . info import constants <EOL> from openstack_dashboard . dashboards . admin . info import tables <EOL> class ServicesTab ( tabs . TableTab ) : <EOL> table_classes = ( tables . ServicesTable , ) <EOL> name = _ ( "<STR_LIT>" ) <EOL> slug = "<STR_LIT>" <EOL> template_name = constants . INFO_DETAIL_TEMPLATE_NAME <EOL> def get_services_data ( self ) : <EOL> request = self . tab_group . request <EOL> services = [ ] <EOL> for i , service in enumerate ( request . user . service_catalog ) : <EOL> service [ '<STR_LIT:id>' ] = i <EOL> services . append ( <EOL> keystone . Service ( service , request . user . services_region ) ) <EOL> return services <EOL> class NovaServicesTab ( tabs . TableTab ) : <EOL> table_classes = ( tables . NovaServicesTable , ) <EOL> name = _ ( "<STR_LIT>" ) <EOL> slug = "<STR_LIT>" <EOL> template_name = constants . INFO_DETAIL_TEMPLATE_NAME <EOL> permissions = ( '<STR_LIT>' , ) <EOL> def get_nova_services_data ( self ) : <EOL> try : <EOL> services = nova . service_list ( self . tab_group . request ) <EOL> except Exception : <EOL> msg = _ ( '<STR_LIT>' ) <EOL> exceptions . check_message ( [ "<STR_LIT>" , "<STR_LIT>" ] , msg ) <EOL> exceptions . handle ( self . request , msg ) <EOL> services = [ ] <EOL> return services <EOL> class CinderServicesTab ( tabs . TableTab ) : <EOL> table_classes = ( tables . CinderServicesTable , ) <EOL> name = _ ( "<STR_LIT>" ) <EOL> slug = "<STR_LIT>" <EOL> template_name = constants . INFO_DETAIL_TEMPLATE_NAME <EOL> permissions = ( '<STR_LIT>' , ) <EOL> def get_cinder_services_data ( self ) : <EOL> try : <EOL> services = cinder . service_list ( self . tab_group . request ) <EOL> except Exception : <EOL> msg = _ ( '<STR_LIT>' ) <EOL> exceptions . check_message ( [ "<STR_LIT>" , "<STR_LIT>" ] , msg ) <EOL> exceptions . handle ( self . request , msg ) <EOL> services = [ ] <EOL> return services <EOL> class NetworkAgentsTab ( tabs . TableTab ) : <EOL> table_classes = ( tables . NetworkAgentsTable , ) <EOL> name = _ ( "<STR_LIT>" ) <EOL> slug = "<STR_LIT>" <EOL> template_name = constants . INFO_DETAIL_TEMPLATE_NAME <EOL> def allowed ( self , request ) : <EOL> try : <EOL> return ( base . is_service_enabled ( request , '<STR_LIT>' ) and <EOL> neutron . is_extension_supported ( request , '<STR_LIT>' ) ) <EOL> except Exception : <EOL> exceptions . handle ( request , _ ( '<STR_LIT>' ) ) <EOL> return False <EOL> def get_network_agents_data ( self ) : <EOL> try : <EOL> agents = neutron . agent_list ( self . tab_group . request ) <EOL> except Exception : <EOL> msg = _ ( '<STR_LIT>' ) <EOL> exceptions . check_message ( [ "<STR_LIT>" , "<STR_LIT>" ] , msg ) <EOL> exceptions . handle ( self . request , msg ) <EOL> agents = [ ] <EOL> return agents <EOL> class SystemInfoTabs ( tabs . TabGroup ) : <EOL> slug = "<STR_LIT>" <EOL> tabs = ( ServicesTab , NovaServicesTab , CinderServicesTab , <EOL> NetworkAgentsTab ) <EOL> sticky = True </s>
