summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-10-24 13:12:46 -0700
committerdanielsdeleo <dan@opscode.com>2013-10-24 13:49:39 -0700
commitcd7ccaea726f3f9d98f9df3f5d56bb22b290f490 (patch)
tree0c424d3d846ba54f59b32cb1bebbfabe25d19c80
parentd5b46e912598981da53d3e9008787bc6af8c645d (diff)
downloadchef-cd7ccaea726f3f9d98f9df3f5d56bb22b290f490.tar.gz
Application::Solo must set @chef_client_json
A past refactor was incomplete, leaving references to chef_solo_json. The contract with the superclass is that json data is set to @chef_client_json Conflicts: spec/integration/solo/solo_spec.rb
-rw-r--r--lib/chef/application/solo.rb4
-rw-r--r--spec/integration/solo/solo_spec.rb24
-rw-r--r--spec/unit/application/solo_spec.rb2
3 files changed, 24 insertions, 6 deletions
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index ba563ce3a8..47825a9701 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -165,7 +165,7 @@ class Chef::Application::Solo < Chef::Application
:long => '--environment ENVIRONMENT',
:description => 'Set the Chef Environment on the node'
- attr_reader :chef_solo_json
+ attr_reader :chef_client_json
def initialize
super
@@ -182,7 +182,7 @@ class Chef::Application::Solo < Chef::Application
if Chef::Config[:json_attribs]
config_fetcher = Chef::ConfigFetcher.new(Chef::Config[:json_attribs])
- @chef_solo_json = config_fetcher.fetch_json
+ @chef_client_json = config_fetcher.fetch_json
end
if Chef::Config[:recipe_url]
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index 90b8273f46..94d279c726 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -9,19 +9,37 @@ describe "chef-solo" do
extend IntegrationSupport
include Chef::Mixin::ShellOut
- when_the_repository "has a cookbook with a no-op recipe" do
+ let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..") }
+
+ when_the_repository "has a cookbook with a basic recipe" do
file 'cookbooks/x/metadata.rb', 'version "1.0.0"'
- file 'cookbooks/x/recipes/default.rb', ''
+ file 'cookbooks/x/recipes/default.rb', 'puts "ITWORKS"'
it "should complete with success" do
file 'config/solo.rb', <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
- chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..")
result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
result.error!
+ result.stdout.should include("ITWORKS")
end
+
+ it "should evaluate its node.json file" do
+ file 'config/solo.rb', <<EOM
+cookbook_path "#{path_to('cookbooks')}"
+file_cache_path "#{path_to('config/cache')}"
+EOM
+
+ file 'config/node.json',<<-E
+{"run_list":["x::default"]}
+E
+
+ result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -j '#{path_to('config/node.json')}' -l debug", :cwd => chef_dir)
+ result.error!
+ result.stdout.should include("ITWORKS")
+ end
+
end
when_the_repository "has a cookbook with a recipe with sleep" do
diff --git a/spec/unit/application/solo_spec.rb b/spec/unit/application/solo_spec.rb
index 6dd8c8f147..41e0cf3b2b 100644
--- a/spec/unit/application/solo_spec.rb
+++ b/spec/unit/application/solo_spec.rb
@@ -60,7 +60,7 @@ describe Chef::Application::Solo do
it "reads the JSON attributes from the specified source" do
@app.reconfigure
- @app.chef_solo_json.should == json_attribs
+ @app.chef_client_json.should == json_attribs
end
end