[shiva,r=james-page] Add profile configuration setting to support cisco.
This commit is contained in:
commit
fe03e37b3b
|
@ -83,6 +83,10 @@ options:
|
|||
type: string
|
||||
default:
|
||||
description: Secret for Horizon to use when securing internal data; set this when using multiple dashboard units.
|
||||
profile:
|
||||
type: string
|
||||
default:
|
||||
description: Default profile for the dashboard. Eg. cisco
|
||||
neutron-network-lb:
|
||||
type: boolean
|
||||
default: False
|
||||
|
|
|
@ -84,6 +84,8 @@ class HorizonContext(OSContextGenerator):
|
|||
"webroot": config('webroot'),
|
||||
"ubuntu_theme": config('ubuntu-theme') in ['yes', True],
|
||||
"secret": config('secret') or pwgen(),
|
||||
'support_profile': config('profile')
|
||||
if config('profile') in ['cisco'] else None,
|
||||
"neutron_network_lb": config("neutron-network-lb"),
|
||||
"neutron_network_firewall": config("neutron-network-firewall"),
|
||||
"neutron_network_vpn": config("neutron-network-vpn"),
|
||||
|
@ -123,3 +125,12 @@ class ApacheSSLContext(OSContextGenerator):
|
|||
'ssl_configured': False,
|
||||
}
|
||||
return ctxt
|
||||
|
||||
|
||||
class RouterSettingContext(OSContextGenerator):
|
||||
def __call__(self):
|
||||
''' Enable/Disable Router Tab on horizon '''
|
||||
ctxt = {
|
||||
'disable_router': False if config('profile') in ['cisco'] else True
|
||||
}
|
||||
return ctxt
|
||||
|
|
|
@ -40,6 +40,8 @@ APACHE_24_SSL = "%s/sites-available/default-ssl.conf" % (APACHE_CONF_DIR)
|
|||
APACHE_24_DEFAULT = "%s/sites-available/000-default.conf" % (APACHE_CONF_DIR)
|
||||
APACHE_SSL = "%s/sites-available/default-ssl" % (APACHE_CONF_DIR)
|
||||
APACHE_DEFAULT = "%s/sites-available/default" % (APACHE_CONF_DIR)
|
||||
ROUTER_SETTING = \
|
||||
"/usr/share/openstack-dashboard/openstack_dashboard/enabled/_40_router.py"
|
||||
|
||||
TEMPLATES = 'templates'
|
||||
|
||||
|
@ -86,6 +88,10 @@ CONFIG_FILES = OrderedDict([
|
|||
'hook_contexts': [horizon_contexts.HorizonHAProxyContext()],
|
||||
'services': ['haproxy'],
|
||||
}),
|
||||
(ROUTER_SETTING, {
|
||||
'hook_contexts': [horizon_contexts.RouterSettingContext()],
|
||||
'services': ['apache2'],
|
||||
}),
|
||||
])
|
||||
|
||||
|
||||
|
@ -122,6 +128,9 @@ def register_configs():
|
|||
configs.register(APACHE_SSL,
|
||||
CONFIG_FILES[APACHE_SSL]['hook_contexts'])
|
||||
|
||||
if os.path.exists(os.path.dirname(ROUTER_SETTING)):
|
||||
configs.register(ROUTER_SETTING,
|
||||
CONFIG_FILES[ROUTER_SETTING]['hook_contexts'])
|
||||
return configs
|
||||
|
||||
|
||||
|
|
|
@ -160,10 +160,16 @@ OPENSTACK_NEUTRON_NETWORK = {
|
|||
# The profile_support option is used to detect if an external router can be
|
||||
# configured via the dashboard. When using specific plugins the
|
||||
# profile_support can be turned on if needed.
|
||||
#'profile_support': None,
|
||||
#'profile_support': 'cisco', # Example of value set to support Cisco
|
||||
{% if support_profile -%}
|
||||
'profile_support': '{{ support_profile }}',
|
||||
{% else -%}
|
||||
'profile_support': None,
|
||||
#'profile_support': 'cisco',
|
||||
{% endif -%}
|
||||
}
|
||||
|
||||
|
||||
# The OPENSTACK_IMAGE_BACKEND settings can be used to customize features
|
||||
# in the OpenStack Dashboard related to the Image service, such as the list
|
||||
# of supported image formats.
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#The name of the dashboard to be added to HORIZON['dashboards']. Required.
|
||||
DASHBOARD = 'router'
|
||||
|
||||
# A list of applications to be added to INSTALLED_APPS.
|
||||
ADD_INSTALLED_APPS = [
|
||||
'openstack_dashboard.dashboards.router',
|
||||
]
|
||||
|
||||
# If set to True, this dashboard will not be added to the settings.
|
||||
DISABLED = {{ disable_router }}
|
|
@ -163,8 +163,13 @@ OPENSTACK_NEUTRON_NETWORK = {
|
|||
# The profile_support option is used to detect if an external router can be
|
||||
# configured via the dashboard. When using specific plugins the
|
||||
# profile_support can be turned on if needed.
|
||||
#'profile_support': None,
|
||||
#'profile_support': 'cisco', # Example of value set to support Cisco
|
||||
{% if support_profile -%}
|
||||
'profile_support': '{{ support_profile }}',
|
||||
{% else -%}
|
||||
'profile_support': None,
|
||||
#'profile_support': 'cisco',
|
||||
{% endif -%}
|
||||
}
|
||||
|
||||
# The OPENSTACK_IMAGE_BACKEND settings can be used to customize features
|
||||
|
|
|
@ -192,8 +192,13 @@ OPENSTACK_NEUTRON_NETWORK = {
|
|||
# The profile_support option is used to detect if an external router can be
|
||||
# configured via the dashboard. When using specific plugins the
|
||||
# profile_support can be turned on if needed.
|
||||
#'profile_support': None,
|
||||
#'profile_support': 'cisco', # Example of value set to support Cisco
|
||||
{% if support_profile -%}
|
||||
'profile_support': '{{ support_profile }}',
|
||||
{% else -%}
|
||||
'profile_support': None,
|
||||
#'profile_support': 'cisco',
|
||||
{% endif -%}
|
||||
# Set which provider network types are supported. Only the network types
|
||||
# in this list will be available to choose from when creating a network.
|
||||
# Network types include local, flat, vlan, gre, and vxlan.
|
||||
|
|
|
@ -81,6 +81,7 @@ class TestHorizonContexts(CharmTestCase):
|
|||
'default_role': 'Member', 'webroot': '/horizon',
|
||||
'ubuntu_theme': True,
|
||||
'secret': 'secret',
|
||||
'support_profile': None,
|
||||
"neutron_network_lb": False,
|
||||
"neutron_network_firewall": False,
|
||||
"neutron_network_vpn": False})
|
||||
|
@ -92,6 +93,7 @@ class TestHorizonContexts(CharmTestCase):
|
|||
'default_role': 'Member', 'webroot': '/horizon',
|
||||
'ubuntu_theme': True,
|
||||
'secret': 'secret',
|
||||
'support_profile': None,
|
||||
"neutron_network_lb": False,
|
||||
"neutron_network_firewall": False,
|
||||
"neutron_network_vpn": False})
|
||||
|
@ -103,6 +105,7 @@ class TestHorizonContexts(CharmTestCase):
|
|||
'default_role': 'Member', 'webroot': '/horizon',
|
||||
'ubuntu_theme': False,
|
||||
'secret': 'secret',
|
||||
'support_profile': None,
|
||||
"neutron_network_lb": False,
|
||||
"neutron_network_firewall": False,
|
||||
"neutron_network_vpn": False})
|
||||
|
@ -114,6 +117,7 @@ class TestHorizonContexts(CharmTestCase):
|
|||
'default_role': 'Member', 'webroot': '/horizon',
|
||||
'ubuntu_theme': True,
|
||||
'secret': 'secret',
|
||||
'support_profile': None,
|
||||
"neutron_network_lb": False,
|
||||
"neutron_network_firewall": False,
|
||||
"neutron_network_vpn": False})
|
||||
|
@ -125,6 +129,7 @@ class TestHorizonContexts(CharmTestCase):
|
|||
'default_role': 'foo', 'webroot': '/horizon',
|
||||
'ubuntu_theme': True,
|
||||
'secret': 'secret',
|
||||
'support_profile': None,
|
||||
"neutron_network_lb": False,
|
||||
"neutron_network_firewall": False,
|
||||
"neutron_network_vpn": False})
|
||||
|
@ -136,6 +141,7 @@ class TestHorizonContexts(CharmTestCase):
|
|||
'default_role': 'Member', 'webroot': '/',
|
||||
'ubuntu_theme': True,
|
||||
'secret': 'secret',
|
||||
'support_profile': None,
|
||||
"neutron_network_lb": False,
|
||||
"neutron_network_firewall": False,
|
||||
"neutron_network_vpn": False})
|
||||
|
@ -200,3 +206,11 @@ class TestHorizonContexts(CharmTestCase):
|
|||
'dash_secure': [443, 433]}})
|
||||
_open.assert_called_with('/etc/default/haproxy', 'w')
|
||||
_file.write.assert_called()
|
||||
|
||||
def test_RouterSettingContext(self):
|
||||
self.test_config.set('profile', 'cisco')
|
||||
self.assertEquals(horizon_contexts.RouterSettingContext()(),
|
||||
{'disable_router': False, })
|
||||
self.test_config.set('profile', None)
|
||||
self.assertEquals(horizon_contexts.RouterSettingContext()(),
|
||||
{'disable_router': True, })
|
||||
|
|
|
@ -45,6 +45,8 @@ class TestHorizonUtils(CharmTestCase):
|
|||
('/etc/apache2/sites-available/000-default.conf', ['apache2']),
|
||||
('/etc/apache2/ports.conf', ['apache2']),
|
||||
('/etc/haproxy/haproxy.cfg', ['haproxy']),
|
||||
('/usr/share/openstack-dashboard/openstack_dashboard/enabled/'
|
||||
'_40_router.py', ['apache2']),
|
||||
])
|
||||
self.assertEquals(horizon_utils.restart_map(), ex_map)
|
||||
|
||||
|
|
Loading…
Reference in New Issue