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
=== modified file 'charmhelpers/contrib/openstack/context.py'
--- charmhelpers/contrib/openstack/context.py 2015-10-07 21:51:23 +0000
+++ charmhelpers/contrib/openstack/context.py 2015-11-19 17:35:47 +0000
@@ -1088,6 +1088,20 @@
1088 config_flags_parser(config_flags)}1088 config_flags_parser(config_flags)}
10891089
10901090
1091class LibvirtConfigFlagsContext(OSContextGenerator):
1092 """
1093 This context provides support for extending
1094 the libvirt section through user-defined flags.
1095 """
1096 def __call__(self):
1097 ctxt = {}
1098 libvirt_flags = config('libvirt-flags')
1099 if libvirt_flags:
1100 ctxt['libvirt_flags'] = config_flags_parser(
1101 libvirt_flags)
1102 return ctxt
1103
1104
1091class SubordinateConfigContext(OSContextGenerator):1105class SubordinateConfigContext(OSContextGenerator):
10921106
1093 """1107 """
10941108
=== modified file 'tests/contrib/openstack/test_os_contexts.py'
--- tests/contrib/openstack/test_os_contexts.py 2015-10-07 10:57:11 +0000
+++ tests/contrib/openstack/test_os_contexts.py 2015-11-19 17:35:47 +0000
@@ -1014,6 +1014,19 @@
10141014
1015 self.assertEquals(result, expected)1015 self.assertEquals(result, expected)
10161016
1017 def test_libvirt_config_flags(self):
1018 self.config.side_effect = fake_config({
1019 'libvirt-flags': 'iscsi_use_multipath=True,chap_auth=False',
1020 })
1021
1022 results = context.LibvirtConfigFlagsContext()()
1023 self.assertEquals(results, {
1024 'libvirt_flags': {
1025 'chap_auth': 'False',
1026 'iscsi_use_multipath': 'True'
1027 }
1028 })
1029
1017 def test_ceph_no_relids(self):1030 def test_ceph_no_relids(self):
1018 '''Test empty ceph realtion'''1031 '''Test empty ceph realtion'''
1019 relation = FakeRelation(relation_data={})1032 relation = FakeRelation(relation_data={})

Subscribers

People subscribed via source and target branches