Class: Train::Extras::CommandWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/train/extras/command_wrapper.rb

Class Method Summary collapse

Class Method Details

.load(transport, options) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/train/extras/command_wrapper.rb', line 140

def self.load(transport, options)
  if transport.os.unix?
    return nil unless LinuxCommand.active?(options)
    res = LinuxCommand.new(transport, options)
    msg = res.verify
    fail Train::UserError, "Sudo failed: #{msg}" unless msg.nil?
    res
  # only use powershell command for local transport. winrm transport
  # uses powershell as default
  elsif transport.os.windows? && transport.class == Train::Transports::Local::Connection
    PowerShellCommand.new(transport, options)
  end
end