Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
#!/usr/bin/env ruby # # Magical rubyness # require 'puppet' require 'yaml' Puppet[:config] = "/etc/puppet/puppet.conf" Puppet.parse_config pm_conf = Puppet.settings.instance_variable_get(:@values)[:main] pm_conf.each do |k, v| print k print ": " print v print "\n" end print "puppetlast\n" Dir.chdir(pm_conf[:vardir] + "/yaml/facts") Dir.glob("*.yaml").each do |yaml| File.open(yaml).each do |yf| fact = YAML::load(yf) fact.each do |fact| puts fact end end puts host end ## root@junglist:~# ./test.rb ## vardir: /var/lib/puppet ## ssldir: /var/lib/puppet/ssl ## factpath: /var/lib/puppet/lib/facter ## logdir: /var/log/puppet ## _meta: vardirssldirfactpathlogdirrundir ## rundir: /var/run/puppet ## puppetlast ## ./test.rb:28: undefined method `each' for #<Puppet::Node::Facts:0xb77b5234> (NoMethodError) ## from ./test.rb:26:in `each' ## from ./test.rb:26 ## from ./test.rb:25:in `each' ## from ./test.rb:25
This paste will be private.
From the Design Piracy series on my blog: