Sha256: 7b89b6f8e33b55bd5290c6f91e0c208a30c1f4141b105065e13f8bad959319dd
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require 'shellwords' module Pec2 class Pssh PSSH_PATH = File.expand_path('../../../exe/bin/pssh', __FILE__) def initialize(options, hosts_file) @pssh_command = "#{PSSH_PATH} -t 0 -x '-tt' -h #{hosts_file} -O StrictHostKeyChecking=no" if options[:print] @pssh_command = "#{@pssh_command} -P" end if options[:user] @pssh_command = "#{@pssh_command} -l #{options[:user]}" end if options[:log] @pssh_command = "#{@pssh_command} -o #{options[:log]}" end if options[:parallel] @pssh_command = "#{@pssh_command} -p #{options[:parallel]}" end @sudo_password = options[:sudo_password] end def build_pssh_command(command) if @sudo_password %Q{(echo #{@sudo_password}) | #{@pssh_command} -I #{Shellwords.escape(command)}} else %Q{#{@pssh_command} -i #{Shellwords.escape(command)}} end end def exec_pssh_command(command) return false if command.nil? || command.empty? build_command = build_pssh_command(command) system(build_command) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pec2-0.5.0 | lib/pec2/pssh.rb |