Revision 4a8411d8
Added by Dmitri Dolguikh almost 11 years ago
- ID 4a8411d8d8cfb7510dc8775b5b1b0a0c8c217c69
lib/proxy/puppet/puppetrun.rb | ||
---|---|---|
# Search in /opt/ for puppet enterprise users
|
||
default_path = ["/usr/sbin", "/usr/bin", "/opt/puppet/bin"]
|
||
# search for puppet for users using puppet 2.6+
|
||
puppetrun = which("puppetrun", default_path) || which("puppet", default_path)
|
||
sudo = which("sudo", "/usr/bin")
|
||
cmd = []
|
||
cmd.push(which("sudo", "/usr/bin"))
|
||
cmd.push(which("puppetrun", default_path) || which("puppet", default_path))
|
||
|
||
unless puppetrun and sudo
|
||
if cmd.include?(false)
|
||
logger.warn "sudo or puppetrun binary was not found - aborting"
|
||
return false
|
||
end
|
||
|
||
# Append kick to the puppet command if we are not using the old puppetca command
|
||
puppetrun << " kick" unless puppetrun.include?('puppetrun')
|
||
|
||
command = %x[#{sudo} #{puppetrun} --host #{nodes.join(" --host ")}]
|
||
unless command =~ /finished with exit code 0/
|
||
logger.warn command
|
||
return false
|
||
end
|
||
return true
|
||
cmd.push("kick") if cmd.any? { |part| part.end_with?('puppet') }
|
||
shell_command(cmd + (shell_escaped_nodes.map {|n| ["--host", n] }).flatten)
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
fixes #2662 - Proxy::Util.escape_for_shell is being used in PuppetRun.run and MCollective.run methods