Class: Spiceweasel::Execute
- Inherits:
-
Object
- Object
- Spiceweasel::Execute
- Defined in:
- lib/spiceweasel/execute.rb
Instance Method Summary collapse
-
#initialize(commands) ⇒ Execute
constructor
run the commands passed in.
Constructor Details
#initialize(commands) ⇒ Execute
run the commands passed in
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/spiceweasel/execute.rb', line 25 def initialize(commands) # for now we're shelling out commands.each do | cmd | Spiceweasel::Log.debug("Command will timeout after #{Spiceweasel::Config[:cmd_timeout]} seconds.") knife = Mixlib::ShellOut.new(cmd.command, cmd.shellout_opts.merge(:live_stream => STDOUT, :timeout => Spiceweasel::Config[:timeout].to_i)) # check for parallel? and eventually use threads knife.run_command puts knife.stderr Spiceweasel::Log.debug(cmd) Spiceweasel::Log.debug(knife.stdout) Spiceweasel::Log.fatal(knife.stderr) if !knife.stderr.empty? find.error! unless cmd.allow_failure? end end |