Class: Chef::Mixin::ShellOut::FakeShellOut
- Inherits:
-
Object
- Object
- Chef::Mixin::ShellOut::FakeShellOut
- Defined in:
- lib/chef/mixin/shell_out.rb
Instance Attribute Summary collapse
-
#exitstatus ⇒ Object
readonly
Returns the value of attribute exitstatus.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #error! ⇒ Object
- #error? ⇒ Boolean
-
#initialize(args, options, result) ⇒ FakeShellOut
constructor
A new instance of FakeShellOut.
Constructor Details
#initialize(args, options, result) ⇒ FakeShellOut
Returns a new instance of FakeShellOut.
194 195 196 197 198 199 200 201 |
# File 'lib/chef/mixin/shell_out.rb', line 194 def initialize(args, , result) @args = args @options = @stdout = result.stdout @stderr = result.stderr @exitstatus = result.exit_status @status = OpenStruct.new(success?: ( exitstatus == 0 )) end |
Instance Attribute Details
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
192 193 194 |
# File 'lib/chef/mixin/shell_out.rb', line 192 def exitstatus @exitstatus end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
192 193 194 |
# File 'lib/chef/mixin/shell_out.rb', line 192 def status @status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
192 193 194 |
# File 'lib/chef/mixin/shell_out.rb', line 192 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
192 193 194 |
# File 'lib/chef/mixin/shell_out.rb', line 192 def stdout @stdout end |
Instance Method Details
#error! ⇒ Object
207 208 209 |
# File 'lib/chef/mixin/shell_out.rb', line 207 def error! raise Mixlib::ShellOut::ShellCommandFailed, "Unexpected exit status of #{exitstatus} running #{@args}" if error? end |
#error? ⇒ Boolean
203 204 205 |
# File 'lib/chef/mixin/shell_out.rb', line 203 def error? exitstatus != 0 end |