Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created December 9, 2010 21:13
Show Gist options
  • Save jordansissel/735352 to your computer and use it in GitHub Desktop.
Save jordansissel/735352 to your computer and use it in GitHub Desktop.
Exported resource querying in Ruby Puppet DSL
require "puppet/rails/resource"
hostclass :happy do
Puppet::Rails::Resource.find_all_by_restype("File").each do |r| #.find_all_by_restype("File").each do |r|
p r
end
end
node :default do
include "happy"
end
% puppet apply --storeconfig --dblocation /tmp/puppet.sqlite testpuppet.rb
#<Puppet::Rails::Resource id: 13, title: "/tmp/x", restype: "File", host_id: 1, source_file_id: 1, exported: true, line: 1, updated_at: "2010-12-09 13:13:03", created_at: "2010-12-09 13:13:03">
% puppet --storeconfigs --dblocation /tmp/puppet.sqlite -e '@@file { "/tmp/x": content => "Hello world\n"; }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment