Ori.livneh has submitted this change and it was merged.
Change subject: Tolerate null class list in Roles.yaml
......................................................................
Tolerate null class list in Roles.yaml
puppet-classifier is currently failing for the default manifest because the
value of 'classes' when all roles are commented out is null (parsed by PyYAML
into None). This patch tolerates null and unset 'classes' in the YAML manifest.
Change-Id: Ie9c37b8bd2cebfbacb2761f1bad762aa2854587d
---
M puppet/extra/puppet-classifier
1 file changed, 5 insertions(+), 4 deletions(-)
Approvals:
Ori.livneh: Verified; Looks good to me, approved
diff --git a/puppet/extra/puppet-classifier b/puppet/extra/puppet-classifier
index 8346aeb..7728929 100755
--- a/puppet/extra/puppet-classifier
+++ b/puppet/extra/puppet-classifier
@@ -17,13 +17,14 @@
empty = dict(classes=[])
try:
- with io.open('/vagrant/Roles.yaml', encoding='utf-8') as f:
+ with io.open('../../Roles.yaml', encoding='utf-8') as f:
manifest = yaml.load(f)
if not isinstance(manifest, dict):
raise ValueError('Manifest document must be a mapping.')
- if not isinstance(manifest.get('classes'), list):
- raise ValueError('Manifest document must define a "classes" key that '
- 'has a list of classes as its value.')
+ if manifest.get('classes') is None:
+ manifest['classes'] = []
+ if not isinstance(manifest['classes'], list):
+ raise ValueError('"classes" must be a list or null.')
except IOError:
# OK -- No Roles.yaml file.
print(yaml.dump(empty))
--
To view, visit https://gerrit.wikimedia.org/r/73526
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie9c37b8bd2cebfbacb2761f1bad762aa2854587d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits