Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: kick.py

Issue 5653767139622912: Issue 213 - Make sure kick.py can still parse Puppet files with newer Puppet releases (Closed)
Patch Set: Created March 26, 2014, 8:47 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: kick.py
===================================================================
--- a/kick.py
+++ b/kick.py
@@ -51,25 +51,26 @@ def parseOptions(args):
sys.exit(1)
return user, mode, args
def readMonitoringConfig():
# Use Puppet's parser to convert monitoringserver.pp into YAML
manifest = os.path.join(os.path.dirname(__file__), 'manifests', 'monitoringserver.pp')
parseScript = '''
+ require 'puppet'
require 'puppet/parser'
parser = Puppet::Parser::Parser.new(Puppet[:environment])
+ Puppet.settings[:ignoreimport] = true
parser.file = ARGV[0]
print ZAML.dump(parser.parse)
'''
data, dummy = subprocess.Popen(['ruby', '', manifest],
stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).communicate(parseScript)
+ stdout=subprocess.PIPE).communicate(parseScript)
Felix Dahlke 2014/03/26 11:19:55 Why ignore stderr now?
Wladimir Palant 2014/03/26 11:27:41 Quite the opposite actually - before this change s
# See http://stackoverflow.com/q/8357650/785541 on parsing Puppet's YAML
yaml.add_multi_constructor(u"!ruby/object:", lambda loader, suffix, node: loader.construct_yaml_map(node))
yaml.add_constructor(u"!ruby/sym", lambda loader, node: loader.construct_yaml_str(node))
return yaml.load(data)
def getValidHosts():
def processNode(node, hosts=None, groups=None):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld