/usr/lib/ruby/1.8/mcprovision/puppetmaster.rb is in mcollective-server-provisioner 0.0.1~git20110120-0ubuntu5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | module MCProvision
class PuppetMaster
def initialize(config)
@config = config
setup
end
# Find all nodes with the configured master agent
def find_all
masters = Nodes.new(@config.settings["master"]["agent"], @config.settings["master"]["filter"], @config)
masters.nodes
end
# Cleans a cert from all masters
def clean_cert(certname)
MCProvision.info("Clean certificate #{certname} from all masters")
@puppetca.clean(:certname => certname)
end
# Signs a cert on all masters
def sign(certname)
MCProvision.info("Signing certificate #{certname} on all masters")
@puppetca.list.each do |list|
if list[:data][:requests].include?(certname)
@puppetca.sign(:certname => certname)
return
end
end
raise "Could not find certificate #{certname} to sign on any master"
end
# resets the rpc client
def reset
@puppetca.reset
end
private
def setup
unless @config.settings["master"].include?("agent") && @config.settings["master"].include?("filter")
raise "The config file master section needs 'agent' and 'filter'"
end
agent = @config.settings["master"]["agent"]
@puppetca = rpcclient(agent)
@puppetca.progress = false
@puppetca.filter = MCProvision::Util.parse_filter(agent, @config.settings["master"]["filter"])
end
end
end
|