class AgileSolo::Consumer
Attributes
chef_repo[R]
data[R]
name[R]
run_list[R]
Public Class Methods
new(payload)
click to toggle source
# File lib/agile_solo/consumer.rb, line 7 def initialize(payload) @name = payload['name'] @run_list = payload['run_list'] @data = MultiJson.dump(payload['items']) @chef_repo = AgileSolo::Config.chef_repo Chef::Config[:data_bag_path] = File.join(@chef_repo, 'data_bags') chef_solo.config[:config_file] = File.join(@chef_repo, 'solo.rb') chef_solo.config[:override_runlist] = [@run_list] end
Public Instance Methods
chef_solo()
click to toggle source
# File lib/agile_solo/consumer.rb, line 18 def chef_solo @chef_solo ||= AgileSolo::Application::Solo.new end
execute()
click to toggle source
# File lib/agile_solo/consumer.rb, line 22 def execute begin update_data_bag chef_solo.run rescue => e puts e.backtrace.join("\n") end end
update_data_bag()
click to toggle source
# File lib/agile_solo/consumer.rb, line 31 def update_data_bag File.open(file_path, 'w') { |f| f.write(data) } end
Protected Instance Methods
file_path()
click to toggle source
# File lib/agile_solo/consumer.rb, line 37 def file_path File.join(Chef::Config[:data_bag_path], name, 'items.json') end