Merge lp:~gnuoy/charms/trusty/openstack-dashboard/plugin-relation into lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/next

Proposed by Liam Young
Status: Merged
Merged at revision: 85
Proposed branch: lp:~gnuoy/charms/trusty/openstack-dashboard/plugin-relation
Merge into: lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/next
Diff against target: 173 lines (+68/-1)
11 files modified
hooks/horizon_contexts.py (+25/-0)
hooks/horizon_hooks.py (+11/-0)
hooks/horizon_utils.py (+2/-1)
metadata.yaml (+3/-0)
templates/essex/local_settings.py (+2/-0)
templates/folsom/local_settings.py (+2/-0)
templates/grizzly/local_settings.py (+2/-0)
templates/havana/local_settings.py (+2/-0)
templates/icehouse/local_settings.py (+2/-0)
templates/juno/local_settings.py (+2/-0)
unit_tests/test_horizon_contexts.py (+15/-0)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/openstack-dashboard/plugin-relation
Reviewer Review Type Date Requested Status
Billy Olsen Approve
Review via email: mp+270683@code.launchpad.net
To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #8946 openstack-dashboard-next for gnuoy mp270683
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/8946/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #9717 openstack-dashboard-next for gnuoy mp270683
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/9717/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6345 openstack-dashboard-next for gnuoy mp270683
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12329358/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6345/

86. By Liam Young

Merge /next in

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #9830 openstack-dashboard-next for gnuoy mp270683
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/9830/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #9055 openstack-dashboard-next for gnuoy mp270683
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/9055/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6364 openstack-dashboard-next for gnuoy mp270683
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12365675/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6364/

87. By Liam Young

Empty commit to trigger osci

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #10466 openstack-dashboard-next for gnuoy mp270683
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/10466/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #9657 openstack-dashboard-next for gnuoy mp270683
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/9657/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6609 openstack-dashboard-next for gnuoy mp270683
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6609/

Revision history for this message
Billy Olsen (billy-olsen) wrote :

LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added symlink 'hooks/dashboard-plugin-relation-changed'
2=== target is u'horizon_hooks.py'
3=== added symlink 'hooks/dashboard-plugin-relation-joined'
4=== target is u'horizon_hooks.py'
5=== modified file 'hooks/horizon_contexts.py'
6--- hooks/horizon_contexts.py 2015-04-09 14:56:00 +0000
7+++ hooks/horizon_contexts.py 2015-09-22 16:36:44 +0000
8@@ -172,3 +172,28 @@
9 'disable_router': False if config('profile') in ['cisco'] else True
10 }
11 return ctxt
12+
13+
14+class LocalSettingsContext(OSContextGenerator):
15+ def __call__(self):
16+ ''' Additional config stanzas to be appended to local_settings.py '''
17+
18+ relations = []
19+
20+ for rid in relation_ids("plugin"):
21+ try:
22+ unit = related_units(rid)[0]
23+ except IndexError:
24+ pass
25+ else:
26+ rdata = relation_get(unit=unit, rid=rid)
27+ if set(('local-settings', 'priority')) <= set(rdata.keys()):
28+ relations.append((unit, rdata))
29+
30+ ctxt = {
31+ 'settings': [
32+ '# {0}\n{1}'.format(u, rd['local-settings'])
33+ for u, rd in sorted(relations,
34+ key=lambda r: r[1]['priority'])]
35+ }
36+ return ctxt
37
38=== modified file 'hooks/horizon_hooks.py'
39--- hooks/horizon_hooks.py 2015-05-07 14:33:05 +0000
40+++ hooks/horizon_hooks.py 2015-09-22 16:36:44 +0000
41@@ -244,6 +244,17 @@
42 nrpe_setup.write()
43
44
45+@hooks.hook('dashboard-plugin-relation-joined')
46+def plugin_relation_joined():
47+ relation_set(release=os_release("openstack-dashboard"))
48+
49+
50+@hooks.hook('dashboard-plugin-relation-changed')
51+@restart_on_change(restart_map())
52+def update_plugin_config():
53+ CONFIGS.write(LOCAL_SETTINGS)
54+
55+
56 def main():
57 try:
58 hooks.execute(sys.argv)
59
60=== modified file 'hooks/horizon_utils.py'
61--- hooks/horizon_utils.py 2015-07-15 18:46:45 +0000
62+++ hooks/horizon_utils.py 2015-09-22 16:36:44 +0000
63@@ -100,7 +100,8 @@
64 (LOCAL_SETTINGS, {
65 'hook_contexts': [horizon_contexts.HorizonContext(),
66 horizon_contexts.IdentityServiceContext(),
67- context.SyslogContext()],
68+ context.SyslogContext(),
69+ horizon_contexts.LocalSettingsContext()],
70 'services': ['apache2']
71 }),
72 (APACHE_CONF, {
73
74=== modified file 'metadata.yaml'
75--- metadata.yaml 2015-08-01 02:34:37 +0000
76+++ metadata.yaml 2015-09-22 16:36:44 +0000
77@@ -19,6 +19,9 @@
78 ha:
79 interface: hacluster
80 scope: container
81+ dashboard-plugin:
82+ interface: dashboard-plugin
83+ scope: container
84 peers:
85 cluster:
86 interface: openstack-dashboard-ha
87
88=== modified file 'templates/essex/local_settings.py'
89--- templates/essex/local_settings.py 2014-02-27 10:07:57 +0000
90+++ templates/essex/local_settings.py 2015-09-22 16:36:44 +0000
91@@ -118,3 +118,5 @@
92 }
93 }
94 }
95+
96+{{ settings|join('\n\n') }}
97
98=== modified file 'templates/folsom/local_settings.py'
99--- templates/folsom/local_settings.py 2014-05-28 16:05:37 +0000
100+++ templates/folsom/local_settings.py 2015-09-22 16:36:44 +0000
101@@ -167,3 +167,5 @@
102 # offline compression by default. To enable online compression, install
103 # the node-less package and enable the following option.
104 COMPRESS_OFFLINE = {{ compress_offline }}
105+
106+{{ settings|join('\n\n') }}
107\ No newline at end of file
108
109=== modified file 'templates/grizzly/local_settings.py'
110--- templates/grizzly/local_settings.py 2014-05-28 16:05:37 +0000
111+++ templates/grizzly/local_settings.py 2015-09-22 16:36:44 +0000
112@@ -263,3 +263,5 @@
113 }
114 }
115 }
116+
117+{{ settings|join('\n\n') }}
118
119=== modified file 'templates/havana/local_settings.py'
120--- templates/havana/local_settings.py 2014-07-22 07:18:55 +0000
121+++ templates/havana/local_settings.py 2015-09-22 16:36:44 +0000
122@@ -483,3 +483,5 @@
123 # installations should have this set accordingly. For more information
124 # see https://docs.djangoproject.com/en/dev/ref/settings/.
125 ALLOWED_HOSTS = '*'
126+
127+{{ settings|join('\n\n') }}
128\ No newline at end of file
129
130=== modified file 'templates/icehouse/local_settings.py'
131--- templates/icehouse/local_settings.py 2014-12-01 23:45:41 +0000
132+++ templates/icehouse/local_settings.py 2015-09-22 16:36:44 +0000
133@@ -514,3 +514,5 @@
134 # installations should have this set accordingly. For more information
135 # see https://docs.djangoproject.com/en/dev/ref/settings/.
136 ALLOWED_HOSTS = '*'
137+
138+{{ settings|join('\n\n') }}
139\ No newline at end of file
140
141=== modified file 'templates/juno/local_settings.py'
142--- templates/juno/local_settings.py 2014-12-01 23:45:41 +0000
143+++ templates/juno/local_settings.py 2015-09-22 16:36:44 +0000
144@@ -619,3 +619,5 @@
145 # installations should have this set accordingly. For more information
146 # see https://docs.djangoproject.com/en/dev/ref/settings/.
147 ALLOWED_HOSTS = '*'
148+
149+{{ settings|join('\n\n') }}
150\ No newline at end of file
151
152=== modified file 'unit_tests/test_horizon_contexts.py'
153--- unit_tests/test_horizon_contexts.py 2015-04-09 14:34:44 +0000
154+++ unit_tests/test_horizon_contexts.py 2015-09-22 16:36:44 +0000
155@@ -251,3 +251,18 @@
156 self.test_config.set('profile', None)
157 self.assertEquals(horizon_contexts.RouterSettingContext()(),
158 {'disable_router': True, })
159+
160+ def test_LocalSettingsContext(self):
161+ self.relation_ids.return_value = ['plugin:0', 'plugin-too:0']
162+ self.related_units.side_effect = [['horizon-plugin/0'],
163+ ['horizon-plugin-too/0']]
164+ self.relation_get.side_effect = [{'priority': 99,
165+ 'local-settings': 'FOO = True'},
166+ {'priority': 60,
167+ 'local-settings': 'BAR = False'}]
168+
169+ self.assertEquals(horizon_contexts.LocalSettingsContext()(),
170+ {'settings': ['# horizon-plugin-too/0\n'
171+ 'BAR = False',
172+ '# horizon-plugin/0\n'
173+ 'FOO = True']})

Subscribers

People subscribed via source and target branches