summaryrefslogtreecommitdiff
path: root/chef/bin/chef-client
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2008-10-08 22:35:53 -0700
committerAdam Jacob <adam@hjksolutions.com>2008-10-08 22:35:53 -0700
commit09ab37385d927d5fcdabfca52ba604b8782e5300 (patch)
treecbd5b4a026ceda07d6ab621c3ce29f80aacaea32 /chef/bin/chef-client
parent4dbefb3728643479f9e7f08c3d517c23b12bb29a (diff)
downloadchef-09ab37385d927d5fcdabfca52ba604b8782e5300.tar.gz
Fixes to allow for JSON Attribute files, removed HTTP header debugging, moved the timer to wrap the entire chef-client run
Diffstat (limited to 'chef/bin/chef-client')
-rwxr-xr-xchef/bin/chef-client18
1 files changed, 16 insertions, 2 deletions
diff --git a/chef/bin/chef-client b/chef/bin/chef-client
index 5b3d8dee84..4f2e62101f 100755
--- a/chef/bin/chef-client
+++ b/chef/bin/chef-client
@@ -19,13 +19,15 @@
# limitations under the License.
require 'optparse'
-require 'chef'
require 'rubygems'
+require 'chef'
require 'facter'
+require 'json'
config = {
:config_file => "/etc/chef/client.rb",
:log_level => :info,
+ :json_attribs => nil,
:noop => false
}
opts = OptionParser.new do |opts|
@@ -33,6 +35,9 @@ opts = OptionParser.new do |opts|
opts.on("-c CONFIG", "--config CONFIG", "The Chef Config file to use") do |c|
config[:config_file] = c
end
+ opts.on("-j JSON_ATTRIBS", "--json-attributes JSON_ATTRIBS", "Load attributes from a JSON file") do |j|
+ config[:json_attribs] = j
+ end
opts.on("-n", "--noop", "Print what you would do, but don't actually do it.") do
config[:noop] = true
end
@@ -49,7 +54,15 @@ opts.parse!(ARGV)
unless File.exists?(config[:config_file]) && File.readable?(config[:config_file])
puts "I cannot find or read the config file: #{config[:config_file]}"
puts opts
- exit
+ exit 1
+end
+
+if config[:json_attribs]
+ unless File.exists?(config[:json_attribs])
+ puts "I cannot find #{config[:json_attribs]}"
+ exit 2
+ end
+ config[:json_attribs] = JSON.parse(IO.read(config[:json_attribs]))
end
# Load our config file
@@ -59,4 +72,5 @@ if config[:log_level]
end
c = Chef::Client.new
+c.json_attribs = config[:json_attribs]
c.run