Class: Taskr::Actions::Shell
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Taskr::Actions::Base
Instance Method Details
#execute ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/taskr/actions.rb', line 113 def execute if parameters.kind_of? Hash user = parameters['as_user'] cmd = parameters['command'] else user = nil end if user `sudo -u #{user} #{cmd}` else `#{cmd}` end unless $?.success? raise "Shell command failed (#{$?}): #{cmd}" end end |