Merge lp:~hopem/charm-helpers/lp1337266 into lp:charm-helpers

Proposed by Edward Hope-Morley
Status: Superseded
Proposed branch: lp:~hopem/charm-helpers/lp1337266
Merge into: lp:charm-helpers
Diff against target: 130 lines (+56/-6)
3 files modified
charmhelpers/contrib/openstack/context.py (+9/-4)
tests/contrib/openstack/test_os_contexts.py (+46/-1)
tests/contrib/storage/test_linux_storage_lvm.py (+1/-1)
To merge this branch: bzr merge lp:~hopem/charm-helpers/lp1337266
Reviewer Review Type Date Requested Status
Jorge Niedbalski (community) Approve
Edward Hope-Morley Needs Resubmitting
Review via email: mp+225464@code.launchpad.net

This proposal has been superseded by a proposal from 2014-07-03.

To post a comment you must log in.
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

LGTM, just a quick fix required; charmhelpers/contrib/openstack/context.py:724 is missed from tests coverage, and that line appears to be a relevant condition.

review: Needs Fixing
lp:~hopem/charm-helpers/lp1337266 updated
179. By Edward Hope-Morley

fixed coverage whole in unit test

Revision history for this message
Edward Hope-Morley (hopem) wrote :

> LGTM, just a quick fix required; charmhelpers/contrib/openstack/context.py:724
> is missed from tests coverage, and that line appears to be a relevant
> condition.

Fixed.

review: Needs Resubmitting
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

LGTM, thanks for the fix.

review: Approve

Unmerged revisions

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 2014-06-26 13:42:36 +0000
+++ charmhelpers/contrib/openstack/context.py 2014-07-03 14:51:35 +0000
@@ -24,6 +24,7 @@
24 unit_get,24 unit_get,
25 unit_private_ip,25 unit_private_ip,
26 ERROR,26 ERROR,
27 INFO
27)28)
2829
29from charmhelpers.contrib.hahelpers.cluster import (30from charmhelpers.contrib.hahelpers.cluster import (
@@ -689,7 +690,7 @@
689 self.interface = interface690 self.interface = interface
690691
691 def __call__(self):692 def __call__(self):
692 ctxt = {}693 ctxt = {'sections': {}}
693 for rid in relation_ids(self.interface):694 for rid in relation_ids(self.interface):
694 for unit in related_units(rid):695 for unit in related_units(rid):
695 sub_config = relation_get('subordinate_configuration',696 sub_config = relation_get('subordinate_configuration',
@@ -715,10 +716,14 @@
715716
716 sub_config = sub_config[self.config_file]717 sub_config = sub_config[self.config_file]
717 for k, v in sub_config.iteritems():718 for k, v in sub_config.iteritems():
718 ctxt[k] = v719 if k == 'sections':
720 for section, config_dict in v.iteritems():
721 log("adding section '%s'" % (section))
722 ctxt[k][section] = config_dict
723 else:
724 ctxt[k] = v
719725
720 if not ctxt:726 log("%d section(s) found" % (len(ctxt['sections'])), level=INFO)
721 ctxt['sections'] = {}
722727
723 return ctxt728 return ctxt
724729
725730
=== modified file 'tests/contrib/openstack/test_os_contexts.py'
--- tests/contrib/openstack/test_os_contexts.py 2014-06-24 12:16:53 +0000
+++ tests/contrib/openstack/test_os_contexts.py 2014-07-03 14:51:35 +0000
@@ -213,6 +213,24 @@
213 - [glance-key2, value2]213 - [glance-key2, value2]
214"""214"""
215215
216CINDER_SUB_CONFIG1 = """
217cinder:
218 /etc/cinder/cinder.conf:
219 sections:
220 cinder-1-section:
221 - [key1, value1]
222"""
223
224CINDER_SUB_CONFIG2 = """
225cinder:
226 /etc/cinder/cinder.conf:
227 sections:
228 cinder-2-section:
229 - [key2, value2]
230 not-a-section:
231 1234
232"""
233
216SUB_CONFIG_RELATION = {234SUB_CONFIG_RELATION = {
217 'nova-subordinate:0': {235 'nova-subordinate:0': {
218 'nova-subordinate/0': {236 'nova-subordinate/0': {
@@ -231,7 +249,19 @@
231 'private-address': 'foo_node1',249 'private-address': 'foo_node1',
232 'subordinate_configuration': 'ea8e09324jkadsfh',250 'subordinate_configuration': 'ea8e09324jkadsfh',
233 },251 },
234 }252 },
253 'cinder-subordinate:0': {
254 'cinder-subordinate/0': {
255 'private-address': 'cinder_node1',
256 'subordinate_configuration': json.dumps(yaml.load(CINDER_SUB_CONFIG1)),
257 },
258 },
259 'cinder-subordinate:1': {
260 'cinder-subordinate/1': {
261 'private-address': 'cinder_node1',
262 'subordinate_configuration': json.dumps(yaml.load(CINDER_SUB_CONFIG2)),
263 },
264 },
235}265}
236266
237# Imported in contexts.py and needs patching in setUp()267# Imported in contexts.py and needs patching in setUp()
@@ -1121,6 +1151,11 @@
1121 config_file='/etc/glance/glance.conf',1151 config_file='/etc/glance/glance.conf',
1122 interface='glance-subordinate',1152 interface='glance-subordinate',
1123 )1153 )
1154 cinder_sub_ctxt = context.SubordinateConfigContext(
1155 service='cinder',
1156 config_file='/etc/cinder/cinder.conf',
1157 interface='cinder-subordinate',
1158 )
1124 foo_sub_ctxt = context.SubordinateConfigContext(1159 foo_sub_ctxt = context.SubordinateConfigContext(
1125 service='foo',1160 service='foo',
1126 config_file='/etc/foo/foo.conf',1161 config_file='/etc/foo/foo.conf',
@@ -1142,6 +1177,16 @@
1142 ['glance-key2', 'value2']]1177 ['glance-key2', 'value2']]
1143 }}1178 }}
1144 )1179 )
1180 self.assertEquals(
1181 cinder_sub_ctxt(),
1182 {'sections': {
1183 'cinder-1-section': [
1184 ['key1', 'value1']],
1185 'cinder-2-section': [
1186 ['key2', 'value2']]
1187
1188 }, 'not-a-section': 1234}
1189 )
11451190
1146 # subrodinate supplies nothing for given config1191 # subrodinate supplies nothing for given config
1147 glance_sub_ctxt.config_file = '/etc/glance/glance-api-paste.ini'1192 glance_sub_ctxt.config_file = '/etc/glance/glance-api-paste.ini'
11481193
=== modified file 'tests/contrib/storage/test_linux_storage_lvm.py'
--- tests/contrib/storage/test_linux_storage_lvm.py 2014-06-23 10:00:22 +0000
+++ tests/contrib/storage/test_linux_storage_lvm.py 2014-07-03 14:51:35 +0000
@@ -22,7 +22,7 @@
22EMPTY_VG_IN_PVDISPLAY = """22EMPTY_VG_IN_PVDISPLAY = """
23 --- Physical volume ---23 --- Physical volume ---
24 PV Name /dev/loop024 PV Name /dev/loop0
25 VG Name 25 VG Name
26 PV Size 10.00 MiB / not usable 2.00 MiB26 PV Size 10.00 MiB / not usable 2.00 MiB
27 Allocatable yes27 Allocatable yes
28 PE Size 4.00 MiB28 PE Size 4.00 MiB

Subscribers

People subscribed via source and target branches