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): |