Skip to content

Commit

Permalink
adds git pull to cook meals
Browse files Browse the repository at this point in the history
  • Loading branch information
slagyr committed Sep 25, 2012
1 parent d1a4f0c commit 3baa208
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/boucher/compute.rb
Expand Up @@ -64,7 +64,7 @@ def self.cook_meal(server, meal)
Boucher::Nagios.remove_host(server)

update_recipes(server)
ssh server, "cd infrastructure && sudo BUTCHER_ENV=#{Boucher::Config[:env]} BRANCH=#{Boucher::Config[:branch]} chef-solo -c config/solo.rb -j config/#{meal}.json"
ssh server, "cd infrastructure && git pull && sudo BUTCHER_ENV=#{Boucher::Config[:env]} BRANCH=#{Boucher::Config[:branch]} chef-solo -c config/solo.rb -j config/#{meal}.json"

Boucher::Nagios.add_host(server)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/boucher/meals.rb
Expand Up @@ -7,15 +7,15 @@ module Boucher
def self.json_to_meal(json)
parser = JSON.parser.new(json, :symbolize_names => true)
config = parser.parse
config[:boucher]
config[:boucher] || {}
end

def self.meals
if @meals.nil?
@meals = {}
Dir.glob(File.join("config", "*.json")).each do |file|
spec = json_to_meal(::IO.read(file))
meal_name = File.basename(file).to_sym
meal_name = File.basename(file)[0...-5].to_sym
@meals[meal_name] = spec
end
end
Expand Down
3 changes: 3 additions & 0 deletions spec/boucher/meals_spec.rb
Expand Up @@ -12,6 +12,9 @@
it "pull classification from json" do
json = "{\"boucher\": {\"foo\": 1,\n \"bar\": 2}}"
Boucher.json_to_meal(json).should == {:foo => 1, :bar => 2}

json = "{}"
Boucher.json_to_meal(json).should == {}
end

it "can classify base server" do
Expand Down

0 comments on commit 3baa208

Please sign in to comment.