Class: Pantry::Chef::RunChefSolo

Inherits:
Pantry::Command
  • Object
show all
Defined in:
lib/pantry/chef/run_chef_solo.rb

Overview

Execute ChefSolo on the current box, returning STDOUT, STDERR, and status code.

Instance Method Summary collapse

Instance Method Details

#perform(message) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/pantry/chef/run_chef_solo.rb', line 7

def perform(message)
  begin
    solo_rb = Pantry.root.join("etc", "chef", "solo.rb")
    stdout, stderr, status = Open3.capture3("chef-solo --config #{solo_rb}")
    [stdout, stderr, status.to_i]
  rescue Exception => e
    # Could not find the chef-solo binary
    ["", e.message, 1]
  end
end