/usr/lib/ruby/1.8/mcprovision/util.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 | module MCProvision::Util
# Parses a -W style filter and return a std filter option
def self.parse_filter(agent, filter)
result = MCollective::Util.empty_filter
filter.split(" ").each do |f|
if f =~ /^(.+?)=(.+)/
result["fact"] << {:fact => $1, :value => $2}
else
result["cf_class"] << f
end
end
result["agent"] << agent
result
end
# Daemonize the current process
def self.daemonize
fork do
Process.setsid
exit if fork
Dir.chdir('/tmp')
STDIN.reopen('/dev/null')
STDOUT.reopen('/dev/null', 'a')
STDERR.reopen('/dev/null', 'a')
if File.directory?("/var/run")
File.open("/var/run/mcprovision.pid", 'w') {|f| f.write(Process.pid) } rescue true
end
yield
end
end
def self.log(msg)
MCProvision.debug(msg)
end
end
|