Add facilities for subordinate charms to affect dashboard settings
This commit is contained in:
parent
8da609078c
commit
4e2835cc9f
|
@ -172,3 +172,22 @@ class RouterSettingContext(OSContextGenerator):
|
|||
'disable_router': False if config('profile') in ['cisco'] else True
|
||||
}
|
||||
return ctxt
|
||||
|
||||
|
||||
class LocalSettingsContext(OSContextGenerator):
|
||||
def __call__(self):
|
||||
''' Additional config stanzas to be appended to local_settings.py '''
|
||||
|
||||
settings = []
|
||||
|
||||
for rid in relation_ids("settings"):
|
||||
for unit in related_units(rid):
|
||||
rdata = relation_get(unit=unit, rid=rid)
|
||||
if 'setting' in rdata:
|
||||
settings.append('# {0}/{1}\n{2}'.format(
|
||||
rid, unit, rdata['setting'])
|
||||
)
|
||||
ctxt = {
|
||||
'settings': settings
|
||||
}
|
||||
return ctxt
|
|
@ -244,6 +244,17 @@ def update_nrpe_config():
|
|||
nrpe_setup.write()
|
||||
|
||||
|
||||
@hooks.hook('settings-relation-joined')
|
||||
def settings_relation_joined():
|
||||
relation_set(release=os_release("openstack-dashboard"))
|
||||
|
||||
|
||||
@hooks.hook('settings-relation-changed')
|
||||
@restart_on_change(restart_map())
|
||||
def update_plugin_config():
|
||||
CONFIGS.write(LOCAL_SETTINGS)
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
hooks.execute(sys.argv)
|
||||
|
|
|
@ -89,7 +89,8 @@ CONFIG_FILES = OrderedDict([
|
|||
(LOCAL_SETTINGS, {
|
||||
'hook_contexts': [horizon_contexts.HorizonContext(),
|
||||
horizon_contexts.IdentityServiceContext(),
|
||||
context.SyslogContext()],
|
||||
context.SyslogContext(),
|
||||
horizon_contexts.LocalSettingsContext()],
|
||||
'services': ['apache2']
|
||||
}),
|
||||
(APACHE_CONF, {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
horizon_hooks.py
|
|
@ -0,0 +1 @@
|
|||
horizon_hooks.py
|
|
@ -17,6 +17,9 @@ requires:
|
|||
ha:
|
||||
interface: hacluster
|
||||
scope: container
|
||||
settings:
|
||||
interface: openstack-dashboard-settings
|
||||
scope: container
|
||||
peers:
|
||||
cluster:
|
||||
interface: openstack-dashboard-ha
|
||||
|
|
|
@ -118,3 +118,5 @@ LOGGING = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
{{ settings|join('\n\n') }}
|
||||
|
|
|
@ -167,3 +167,5 @@ LOGIN_REDIRECT_URL='{{ webroot }}'
|
|||
# offline compression by default. To enable online compression, install
|
||||
# the node-less package and enable the following option.
|
||||
COMPRESS_OFFLINE = {{ compress_offline }}
|
||||
|
||||
{{ settings|join('\n\n') }}
|
|
@ -263,3 +263,5 @@ LOGGING = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
{{ settings|join('\n\n') }}
|
||||
|
|
|
@ -483,3 +483,5 @@ COMPRESS_OFFLINE = {{ compress_offline }}
|
|||
# installations should have this set accordingly. For more information
|
||||
# see https://docs.djangoproject.com/en/dev/ref/settings/.
|
||||
ALLOWED_HOSTS = '*'
|
||||
|
||||
{{ settings|join('\n\n') }}
|
|
@ -514,3 +514,5 @@ COMPRESS_OFFLINE = {{ compress_offline }}
|
|||
# installations should have this set accordingly. For more information
|
||||
# see https://docs.djangoproject.com/en/dev/ref/settings/.
|
||||
ALLOWED_HOSTS = '*'
|
||||
|
||||
{{ settings|join('\n\n') }}
|
|
@ -619,3 +619,5 @@ LOGIN_REDIRECT_URL='{{ webroot }}'
|
|||
# installations should have this set accordingly. For more information
|
||||
# see https://docs.djangoproject.com/en/dev/ref/settings/.
|
||||
ALLOWED_HOSTS = '*'
|
||||
|
||||
{{ settings|join('\n\n') }}
|
Loading…
Reference in New Issue