Skip to content
Browse files

adds git pull to cook meals

  • Loading branch information...
1 parent d1a4f0c commit 3baa2081777c2a07996ffce2f36d60d8184a2096 @slagyr slagyr committed Sep 25, 2012
Showing with 6 additions and 3 deletions.
  1. +1 −1 lib/boucher/compute.rb
  2. +2 −2 lib/boucher/meals.rb
  3. +3 −0 spec/boucher/meals_spec.rb
View
2 lib/boucher/compute.rb
@@ -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
View
4 lib/boucher/meals.rb
@@ -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
View
3 spec/boucher/meals_spec.rb
@@ -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

0 comments on commit 3baa208

Please sign in to comment.
Something went wrong with that request. Please try again.