summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Walters, Tim Hinderliter <cw@opscode.com,tim@opscode.com>2010-05-27 19:49:07 +0000
committerDaniel DeLeo <dan@opscode.com>2010-06-03 12:22:10 -0700
commit9eecf1ffcdeda70494d88d8adac004a9985d61ac (patch)
tree6f4d119e6e15947daa3741855724bda1ba28d28a
parent661d0066a6671323ebb846821186fcefffd1774d (diff)
downloadchef-9eecf1ffcdeda70494d88d8adac004a9985d61ac.tar.gz
Moved logic out of Chef::Client initialization so that chef-solo can configure it before node_name and run_list are determined. LWRP cukes passing.
-rw-r--r--chef/lib/chef/application/solo.rb6
-rw-r--r--chef/lib/chef/client.rb14
-rw-r--r--features/cookbooks/lightweight_resources_and_providers.feature6
-rw-r--r--features/data/cookbooks/integration_setup/recipes/default.rb1
-rw-r--r--features/steps/node_steps.rb6
-rw-r--r--features/steps/run_solo.rb4
6 files changed, 16 insertions, 21 deletions
diff --git a/chef/lib/chef/application/solo.rb b/chef/lib/chef/application/solo.rb
index c826133029..1a580c197e 100644
--- a/chef/lib/chef/application/solo.rb
+++ b/chef/lib/chef/application/solo.rb
@@ -95,12 +95,6 @@ class Chef::Application::Solo < Chef::Application
:description => "The splay time for running at intervals, in seconds",
:proc => lambda { |s| s.to_i }
- option :json_attribs,
- :short => "-j JSON_ATTRIBS",
- :long => "--json-attributes JSON_ATTRIBS",
- :description => "Load attributes from a JSON file or URL",
- :proc => nil
-
option :recipe_url,
:short => "-r RECIPE_URL",
:long => "--recipe-url RECIPE_URL",
diff --git a/chef/lib/chef/client.rb b/chef/lib/chef/client.rb
index 47d0ed6c52..4223b7bb50 100644
--- a/chef/lib/chef/client.rb
+++ b/chef/lib/chef/client.rb
@@ -49,11 +49,6 @@ class Chef
Chef::Log.verbose = Chef::Config[:verbose_logging]
Mixlib::Authentication::Log.logger = Ohai::Log.logger = Chef::Log.logger
@ohai_has_run = false
-
- run_ohai
- determine_node_name
- register unless Chef::Config[:solo]
- build_node
end
# Do a full run for this Chef::Client. Calls:
@@ -69,6 +64,12 @@ class Chef
def run
self.runner = nil
run_context = nil
+
+ run_ohai
+ determine_node_name
+ register unless Chef::Config[:solo]
+ build_node
+
begin
start_time = Time.now
Chef::Log.info("Starting Chef Run")
@@ -154,7 +155,6 @@ class Chef
node_name
end
-
# Builds a new node object for this client. Starts with querying for the FQDN of the current
# host (unless it is supplied), then merges in the facts from Ohai.
#
@@ -176,7 +176,7 @@ class Chef
self.node = Chef::Node.new
node.name(node_name)
end
-
+
node.consume_attributes(json_attribs)
node.automatic_attrs = ohai.data
diff --git a/features/cookbooks/lightweight_resources_and_providers.feature b/features/cookbooks/lightweight_resources_and_providers.feature
index 8b5454f6e3..24fc7c5590 100644
--- a/features/cookbooks/lightweight_resources_and_providers.feature
+++ b/features/cookbooks/lightweight_resources_and_providers.feature
@@ -1,7 +1,7 @@
@lwrp @cookbooks
Feature: Light-weight resources and providers
- @solo
+ @solo @lwrp_solo
Scenario Outline: Chef solo handles light-weight resources and providers
Given a local cookbook repository
When I run chef-solo with the 'lwrp::<recipe>' recipe
@@ -20,7 +20,7 @@ Feature: Light-weight resources and providers
| provider_is_a_class | Provider is a class |
| provider_is_omitted | P=Chef::Provider::LwrpProviderIsOmitted, R=Chef::Resource::LwrpProviderIsOmitted |
- @solo
+ @solo @lwrp_solo
Scenario: Chef solo properly handles providers that invoke resources in their action definitions
Given a local cookbook repository
When I run chef-solo with the 'lwrp::provider_invokes_resource' recipe
@@ -29,7 +29,7 @@ Feature: Light-weight resources and providers
@client @lwrp_api
Scenario Outline: Chef-client handles light-weight resources and providers
- Given a validated node
+ Given a validated node with an empty runlist
And it includes the recipe 'lwrp::<recipe>'
When I run the chef-client
Then the run should exit '0'
diff --git a/features/data/cookbooks/integration_setup/recipes/default.rb b/features/data/cookbooks/integration_setup/recipes/default.rb
index fc913b4502..e89bbc3b1d 100644
--- a/features/data/cookbooks/integration_setup/recipes/default.rb
+++ b/features/data/cookbooks/integration_setup/recipes/default.rb
@@ -18,7 +18,6 @@
#
directory node[:int][:tmpdir] do
- owner "root"
mode "1777"
action :create
end
diff --git a/features/steps/node_steps.rb b/features/steps/node_steps.rb
index 7a74450a84..0c10475736 100644
--- a/features/steps/node_steps.rb
+++ b/features/steps/node_steps.rb
@@ -20,13 +20,15 @@
# Given
###
Given /^a validated node$/ do
+ client.run_ohai
client.determine_node_name
client.register
client.build_node
- client.node.recipes << "integration_setup"
+ client.node.run_list << "integration_setup"
end
Given /^a validated node with an empty runlist$/ do
+ client.run_ohai
client.determine_node_name
client.register
client.build_node
@@ -35,7 +37,7 @@ end
Given /^it includes the recipe '(.+)'$/ do |recipe|
self.recipe = recipe
- client.node.recipes << recipe
+ client.node.run_list << recipe
client.save_node
end
diff --git a/features/steps/run_solo.rb b/features/steps/run_solo.rb
index e1fea20253..e9157d8bd1 100644
--- a/features/steps/run_solo.rb
+++ b/features/steps/run_solo.rb
@@ -3,7 +3,7 @@ When /^I run chef-solo with the '(.+)' recipe$/ do |recipe_name|
# Set up the JSON file with the recipe we want to run.
dna_file = "#{tmpdir}/chef-solo-features-dna.json"
File.open(dna_file, "w") do |fp|
- fp.write("{ \"recipes\": [\"#{recipe_name}\"] }")
+ fp.write("{ \"run_list\": [\"#{recipe_name}\"] }")
end
cleanup_files << "#{tmpdir}/chef-solo-features-dna.json"
@@ -75,4 +75,4 @@ When /^I run chef-solo without cookbooks$/ do
@status = status
print_output if ENV['LOG_LEVEL'] == 'debug'
-end \ No newline at end of file
+end