From b49bd8b8ea4bd4e6dbf548ccf22188bedd5cbed4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 16 Apr 2013 13:23:00 -0700 Subject: [PATCH] Properly set the chef-solo run list [GH-1608] --- CHANGELOG.md | 2 ++ plugins/provisioners/chef/config/base.rb | 7 +++++++ plugins/provisioners/chef/provisioner/base.rb | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca5a2fd6c..2f31b8081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## 1.2.1 (unreleased) +BUG FIXES: + - Chef solo run list properly set. [GH-1608] ## 1.2.0 (April 16, 2013) diff --git a/plugins/provisioners/chef/config/base.rb b/plugins/provisioners/chef/config/base.rb index 2d0593fef..9334b6dd5 100644 --- a/plugins/provisioners/chef/config/base.rb +++ b/plugins/provisioners/chef/config/base.rb @@ -61,6 +61,13 @@ module VagrantPlugins @log_level = @log_level.to_sym end + def merge(other) + super.tap do |result| + result.instance_variable_set(:@json, @json.merge(other.json)) + result.instance_variable_set(:@run_list, (@run_list + other.run_list)) + end + end + # Adds a recipe to the run list def add_recipe(name) name = "recipe[#{name}]" unless name =~ /^recipe\[(.+?)\]$/ diff --git a/plugins/provisioners/chef/provisioner/base.rb b/plugins/provisioners/chef/provisioner/base.rb index f6589c18a..f201234c2 100644 --- a/plugins/provisioners/chef/provisioner/base.rb +++ b/plugins/provisioners/chef/provisioner/base.rb @@ -75,7 +75,9 @@ module VagrantPlugins @machine.env.ui.info I18n.t("vagrant.provisioners.chef.json") # Get the JSON that we're going to expose to Chef - json = JSON.pretty_generate(@config.json) + json = @config.json + json[:run_list] = @config.run_list if !@config.run_list.empty? + json = JSON.pretty_generate(json) # Create a temporary file to store the data so we # can upload it