Sha256: e6b6f2c997b044c810f616bb88c5ceef30e871fa18345231bf2187ced3c81654
Contents?: true
Size: 811 Bytes
Versions: 1
Compression:
Stored size: 811 Bytes
Contents
require "web-puppet/version" require 'rack' require 'puppet' require 'json' module WebPuppet class App def call env Puppet[:config] = "/etc/puppet/puppet.conf" Puppet.parse_config Puppet[:clientyamldir] = "$yamldir" Puppet::Node.indirection.terminus_class = :yaml nodes = Puppet::Node.indirection.search("*") data = {} nodes.each do |n| facts = Puppet::Node::Facts.indirection.find(n.name) tags = Puppet::Resource::Catalog.indirection.find(n.name).tags data[n.name] = { :facts => facts.values, :tags => tags } end response = Rack::Response.new response.header['Content-Type'] = 'application/json' response.write JSON.pretty_generate(data) response.finish end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
web-puppet-0.0.1 | lib/web-puppet.rb |