module Admiral::Shell
Public Class Methods
local(cmd, options={}, live = false)
click to toggle source
# File lib/admiral/shell.rb, line 7 def self.local(cmd, options={}, live = false) sh = Mixlib::ShellOut.new(cmd, options) if live sh.live_stdout = STDOUT end sh.run_command if sh.error? puts "Failed to run #{cmd}" puts sh.stderr return nil else return sh.stdout end end
remote(host, username, keyfile, cmd)
click to toggle source
# File lib/admiral/shell.rb, line 24 def self.remote (host, username, keyfile, cmd) Kernel.exec("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no #{username}@#{host} -i #{keyfile}") end