class NexusSW::LXD::Transport::Mixins::Helpers::ExecuteMixin::ExecuteResult
Attributes
command[R]
exitstatus[R]
options[R]
Public Class Methods
new(command, options, exitstatus)
click to toggle source
# File lib/nexussw/lxd/transport/mixins/helpers/execute.rb, line 10 def initialize(command, options, exitstatus) @command = command @options = options || {} @exitstatus = exitstatus end
Public Instance Methods
error!()
click to toggle source
# File lib/nexussw/lxd/transport/mixins/helpers/execute.rb, line 26 def error! return self if exitstatus == 0 msg = "Error: '#{command}' failed with exit code #{exitstatus}.\n" # msg += (" while running as '#{username}'.\n" if username) || ".\n" msg += "STDOUT: #{stdout}" if stdout.is_a?(String) && !stdout.empty? msg += "STDERR: #{stderr}" if stderr.is_a?(String) && !stderr.empty? raise ::NexusSW::LXD::RestAPI::Error, msg end
error?()
click to toggle source
# File lib/nexussw/lxd/transport/mixins/helpers/execute.rb, line 35 def error? exitstatus != 0 end
stderr()
click to toggle source
# File lib/nexussw/lxd/transport/mixins/helpers/execute.rb, line 22 def stderr options[:capture_options][:stderr] if options.key? :capture_options end
stdout()
click to toggle source
# File lib/nexussw/lxd/transport/mixins/helpers/execute.rb, line 18 def stdout options[:capture_options][:stdout] if options.key? :capture_options end