Merge lp:~niedbalski/charm-helpers/fix-1518001 into lp:charm-helpers

Proposed by Jorge Niedbalski
Status: Merged
Merged at revision: 487
Proposed branch: lp:~niedbalski/charm-helpers/fix-1518001
Merge into: lp:charm-helpers
Diff against target: 48 lines (+27/-0)
2 files modified
charmhelpers/contrib/openstack/context.py (+14/-0)
tests/contrib/openstack/test_os_contexts.py (+13/-0)
To merge this branch: bzr merge lp:~niedbalski/charm-helpers/fix-1518001
Reviewer Review Type Date Requested Status
Jorge Niedbalski (community) Approve
Felipe Reyes (community) Approve
Review via email: mp+278048@code.launchpad.net

Description of the change

Dear Maintainer:

This patch adds a new context for handling the libvirt options
in the same way config-flags affects the default section.

To post a comment you must log in.
Revision history for this message
Felipe Reyes (freyes) wrote :

LGTM +1

review: Approve
Revision history for this message
Jorge Niedbalski (niedbalski) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/openstack/context.py'
2--- charmhelpers/contrib/openstack/context.py 2015-10-07 21:51:23 +0000
3+++ charmhelpers/contrib/openstack/context.py 2015-11-19 17:35:47 +0000
4@@ -1088,6 +1088,20 @@
5 config_flags_parser(config_flags)}
6
7
8+class LibvirtConfigFlagsContext(OSContextGenerator):
9+ """
10+ This context provides support for extending
11+ the libvirt section through user-defined flags.
12+ """
13+ def __call__(self):
14+ ctxt = {}
15+ libvirt_flags = config('libvirt-flags')
16+ if libvirt_flags:
17+ ctxt['libvirt_flags'] = config_flags_parser(
18+ libvirt_flags)
19+ return ctxt
20+
21+
22 class SubordinateConfigContext(OSContextGenerator):
23
24 """
25
26=== modified file 'tests/contrib/openstack/test_os_contexts.py'
27--- tests/contrib/openstack/test_os_contexts.py 2015-10-07 10:57:11 +0000
28+++ tests/contrib/openstack/test_os_contexts.py 2015-11-19 17:35:47 +0000
29@@ -1014,6 +1014,19 @@
30
31 self.assertEquals(result, expected)
32
33+ def test_libvirt_config_flags(self):
34+ self.config.side_effect = fake_config({
35+ 'libvirt-flags': 'iscsi_use_multipath=True,chap_auth=False',
36+ })
37+
38+ results = context.LibvirtConfigFlagsContext()()
39+ self.assertEquals(results, {
40+ 'libvirt_flags': {
41+ 'chap_auth': 'False',
42+ 'iscsi_use_multipath': 'True'
43+ }
44+ })
45+
46 def test_ceph_no_relids(self):
47 '''Test empty ceph realtion'''
48 relation = FakeRelation(relation_data={})

Subscribers

People subscribed via source and target branches