chef 0.9.14.beta.1 → 0.9.14.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/checksum_cache.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +2 -2
- data/lib/chef/couchdb.rb +1 -1
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/exceptions.rb +1 -0
- data/lib/chef/file_cache.rb +1 -1
- data/lib/chef/handler/json_file.rb +1 -1
- data/lib/chef/index_queue/amqp_client.rb +1 -1
- data/lib/chef/index_queue/consumer.rb +1 -1
- data/lib/chef/index_queue/indexable.rb +0 -1
- data/lib/chef/{json.rb → json_compat.rb} +1 -1
- data/lib/chef/knife.rb +6 -6
- data/lib/chef/knife/bluebox_images_list.rb +1 -1
- data/lib/chef/knife/bluebox_server_create.rb +1 -1
- data/lib/chef/knife/bluebox_server_delete.rb +1 -1
- data/lib/chef/knife/bluebox_server_list.rb +1 -1
- data/lib/chef/knife/bootstrap.rb +1 -1
- data/lib/chef/knife/client_bulk_delete.rb +1 -1
- data/lib/chef/knife/client_create.rb +1 -1
- data/lib/chef/knife/client_delete.rb +1 -1
- data/lib/chef/knife/client_edit.rb +1 -1
- data/lib/chef/knife/client_list.rb +1 -1
- data/lib/chef/knife/client_reregister.rb +1 -1
- data/lib/chef/knife/client_show.rb +1 -1
- data/lib/chef/knife/cookbook_create.rb +1 -1
- data/lib/chef/knife/cookbook_list.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/cookbook_show.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +1 -1
- data/lib/chef/knife/cookbook_site_unshare.rb +1 -0
- data/lib/chef/knife/data_bag_delete.rb +1 -0
- data/lib/chef/knife/data_bag_from_file.rb +1 -0
- data/lib/chef/knife/ec2_instance_data.rb +1 -1
- data/lib/chef/knife/ec2_server_create.rb +2 -2
- data/lib/chef/knife/ec2_server_delete.rb +1 -1
- data/lib/chef/knife/ec2_server_list.rb +1 -1
- data/lib/chef/knife/node_bulk_delete.rb +1 -1
- data/lib/chef/knife/node_create.rb +1 -1
- data/lib/chef/knife/node_delete.rb +1 -1
- data/lib/chef/knife/node_edit.rb +1 -1
- data/lib/chef/knife/node_from_file.rb +1 -1
- data/lib/chef/knife/node_list.rb +1 -1
- data/lib/chef/knife/node_run_list_add.rb +1 -1
- data/lib/chef/knife/node_run_list_remove.rb +1 -1
- data/lib/chef/knife/node_show.rb +1 -1
- data/lib/chef/knife/rackspace_server_create.rb +1 -1
- data/lib/chef/knife/rackspace_server_delete.rb +1 -1
- data/lib/chef/knife/rackspace_server_list.rb +1 -1
- data/lib/chef/knife/role_bulk_delete.rb +1 -1
- data/lib/chef/knife/role_create.rb +1 -1
- data/lib/chef/knife/role_delete.rb +1 -1
- data/lib/chef/knife/role_edit.rb +1 -1
- data/lib/chef/knife/role_from_file.rb +1 -1
- data/lib/chef/knife/role_list.rb +1 -1
- data/lib/chef/knife/role_show.rb +1 -1
- data/lib/chef/knife/slicehost_images_list.rb +1 -1
- data/lib/chef/knife/slicehost_server_create.rb +1 -1
- data/lib/chef/knife/slicehost_server_delete.rb +1 -1
- data/lib/chef/knife/slicehost_server_list.rb +1 -1
- data/lib/chef/knife/terremark_server_create.rb +1 -1
- data/lib/chef/knife/terremark_server_delete.rb +1 -1
- data/lib/chef/knife/terremark_server_list.rb +1 -1
- data/lib/chef/log.rb +10 -5
- data/lib/chef/monkey_patches/regexp.rb +34 -0
- data/lib/chef/node.rb +1 -1
- data/lib/chef/openid_registration.rb +1 -1
- data/lib/chef/provider/deploy/revision.rb +5 -1
- data/lib/chef/provider/erl_call.rb +19 -3
- data/lib/chef/provider/package/apt.rb +1 -1
- data/lib/chef/provider/package/yum.rb +29 -3
- data/lib/chef/provider/service/simple.rb +1 -1
- data/lib/chef/resource/solaris_package.rb +1 -0
- data/lib/chef/resource/yum_package.rb +1 -0
- data/lib/chef/rest.rb +12 -11
- data/lib/chef/role.rb +2 -2
- data/lib/chef/shef.rb +4 -3
- data/lib/chef/shef/ext.rb +3 -2
- data/lib/chef/shell_out.rb +5 -0
- data/lib/chef/tasks/chef_repo.rake +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/webui_user.rb +1 -1
- metadata +6 -5
@@ -49,7 +49,7 @@ class Chef
|
|
49
49
|
@current_resource.running false
|
50
50
|
nil
|
51
51
|
end
|
52
|
-
|
52
|
+
else
|
53
53
|
Chef::Log.debug "#{@new_resource}: falling back to process table inspection"
|
54
54
|
if ps_cmd.nil? or ps_cmd.empty?
|
55
55
|
raise Chef::Exceptions::Service, "#{@new_resource}: could not determine how to inspect the process table, please set this nodes 'command.ps' attribute"
|
data/lib/chef/rest.rb
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
require 'net/https'
|
24
24
|
require 'uri'
|
25
|
-
require 'chef/
|
25
|
+
require 'chef/json_compat'
|
26
26
|
require 'tempfile'
|
27
27
|
require 'chef/api_client'
|
28
28
|
require 'chef/rest/auth_credentials'
|
@@ -79,9 +79,10 @@ class Chef
|
|
79
79
|
Chef::Log.debug("Registration response: #{response.inspect}")
|
80
80
|
raise Chef::Exceptions::CannotWritePrivateKey, "The response from the server did not include a private key!" unless response.has_key?("private_key")
|
81
81
|
# Write out the private key
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
::File.open(destination, "w") {|f|
|
83
|
+
f.chmod(0600)
|
84
|
+
f.print(response["private_key"])
|
85
|
+
}
|
85
86
|
throw :done
|
86
87
|
rescue IOError
|
87
88
|
raise Chef::Exceptions::CannotWritePrivateKey, "I cannot write your private key to #{destination}"
|
@@ -162,7 +163,7 @@ class Chef
|
|
162
163
|
#
|
163
164
|
# Will return the body of the response on success.
|
164
165
|
def run_request(method, url, headers={}, data=false, limit=nil, raw=false)
|
165
|
-
json_body = data ? Chef::
|
166
|
+
json_body = data ? Chef::JSONCompat.to_json(data) : nil
|
166
167
|
headers = build_headers(method, url, headers, json_body, raw)
|
167
168
|
|
168
169
|
tf = nil
|
@@ -180,7 +181,7 @@ class Chef
|
|
180
181
|
if res.kind_of?(Net::HTTPSuccess)
|
181
182
|
if res['content-type'] =~ /json/
|
182
183
|
response_body = res.body.chomp
|
183
|
-
Chef::
|
184
|
+
Chef::JSONCompat.from_json(response_body)
|
184
185
|
else
|
185
186
|
if method == :HEAD
|
186
187
|
true
|
@@ -196,7 +197,7 @@ class Chef
|
|
196
197
|
false
|
197
198
|
else
|
198
199
|
if res['content-type'] =~ /json/
|
199
|
-
exception = Chef::
|
200
|
+
exception = Chef::JSONCompat.from_json(res.body)
|
200
201
|
msg = "HTTP Request Returned #{res.code} #{res.message}: "
|
201
202
|
msg << (exception["error"].respond_to?(:join) ? exception["error"].join(", ") : exception["error"].to_s)
|
202
203
|
Chef::Log.warn(msg)
|
@@ -208,7 +209,7 @@ class Chef
|
|
208
209
|
|
209
210
|
# Runs an HTTP request to a JSON API. File Download not supported.
|
210
211
|
def api_request(method, url, headers={}, data=false)
|
211
|
-
json_body = data ? Chef::
|
212
|
+
json_body = data ? Chef::JSONCompat.to_json(data) : nil
|
212
213
|
headers = build_headers(method, url, headers, json_body)
|
213
214
|
|
214
215
|
retriable_rest_request(method, url, json_body, headers) do |rest_request|
|
@@ -216,7 +217,7 @@ class Chef
|
|
216
217
|
|
217
218
|
if response.kind_of?(Net::HTTPSuccess)
|
218
219
|
if response['content-type'] =~ /json/
|
219
|
-
Chef::
|
220
|
+
Chef::JSONCompat.from_json(response.body.chomp)
|
220
221
|
else
|
221
222
|
Chef::Log.warn("Expected JSON response, but got content-type '#{response['content-type']}'")
|
222
223
|
response.body
|
@@ -225,7 +226,7 @@ class Chef
|
|
225
226
|
follow_redirect {api_request(:GET, create_url(redirect_location))}
|
226
227
|
else
|
227
228
|
if response['content-type'] =~ /json/
|
228
|
-
exception = Chef::
|
229
|
+
exception = Chef::JSONCompat.from_json(response.body)
|
229
230
|
msg = "HTTP Request Returned #{response.code} #{response.message}: "
|
230
231
|
msg << (exception["error"].respond_to?(:join) ? exception["error"].join(", ") : exception["error"].to_s)
|
231
232
|
Chef::Log.warn(msg)
|
@@ -246,7 +247,7 @@ class Chef
|
|
246
247
|
headers = build_headers(:GET, url, headers, nil, true)
|
247
248
|
retriable_rest_request(:GET, url, nil, headers) do |rest_request|
|
248
249
|
tempfile = nil
|
249
|
-
response = rest_request.call do |r|
|
250
|
+
response = rest_request.call do |r|
|
250
251
|
if block_given? && r.kind_of?(Net::HTTPSuccess)
|
251
252
|
begin
|
252
253
|
tempfile = stream_to_tempfile(url, r, &block)
|
data/lib/chef/role.rb
CHANGED
@@ -25,7 +25,7 @@ require 'chef/couchdb'
|
|
25
25
|
require 'chef/run_list'
|
26
26
|
require 'chef/index_queue'
|
27
27
|
require 'extlib'
|
28
|
-
require 'chef/
|
28
|
+
require 'chef/json_compat'
|
29
29
|
|
30
30
|
class Chef
|
31
31
|
class Role
|
@@ -255,7 +255,7 @@ class Chef
|
|
255
255
|
rb_file = File.join(Chef::Config[:role_path], "#{name}.rb")
|
256
256
|
|
257
257
|
if File.exists?(js_file) || force == "json"
|
258
|
-
Chef::
|
258
|
+
Chef::JSONCompat.from_json(IO.read(js_file))
|
259
259
|
elsif File.exists?(rb_file) || force == "ruby"
|
260
260
|
role = Chef::Role.new
|
261
261
|
role.name(name)
|
data/lib/chef/shef.rb
CHANGED
@@ -24,8 +24,9 @@ require 'chef/version'
|
|
24
24
|
require "chef/client"
|
25
25
|
require "chef/config"
|
26
26
|
|
27
|
-
require
|
28
|
-
require
|
27
|
+
require 'chef/shef/shef_session'
|
28
|
+
require 'chef/shef/ext'
|
29
|
+
require 'chef/json_compat'
|
29
30
|
|
30
31
|
# = Shef
|
31
32
|
# Shef is Chef in an IRB session. Shef can interact with a Chef server via the
|
@@ -163,7 +164,7 @@ module Shef
|
|
163
164
|
end
|
164
165
|
|
165
166
|
begin
|
166
|
-
@json_attribs = Chef::
|
167
|
+
@json_attribs = Chef::JSONCompat.from_json(json_io.read)
|
167
168
|
rescue JSON::ParserError => error
|
168
169
|
fatal!("Could not parse the provided JSON file (#{Chef::Config[:json_attribs]})!: " + error.message, 2)
|
169
170
|
end
|
data/lib/chef/shef/ext.rb
CHANGED
@@ -23,6 +23,7 @@ require 'chef/version'
|
|
23
23
|
require 'chef/shef/shef_session'
|
24
24
|
require 'chef/shef/model_wrapper'
|
25
25
|
require 'chef/shef/shef_rest'
|
26
|
+
require 'chef/json_compat'
|
26
27
|
|
27
28
|
module Shef
|
28
29
|
module Extensions
|
@@ -327,13 +328,13 @@ E
|
|
327
328
|
|
328
329
|
edited_data = Tempfile.open([filename, ".js"]) do |tempfile|
|
329
330
|
tempfile.sync = true
|
330
|
-
tempfile.puts Chef::
|
331
|
+
tempfile.puts Chef::JSONCompat.to_json(object)
|
331
332
|
system("#{Shef.editor.to_s} #{tempfile.path}")
|
332
333
|
tempfile.rewind
|
333
334
|
tempfile.read
|
334
335
|
end
|
335
336
|
|
336
|
-
Chef::
|
337
|
+
Chef::JSONCompat.from_json(edited_data)
|
337
338
|
end
|
338
339
|
|
339
340
|
desc "Find and edit API clients"
|
data/lib/chef/shell_out.rb
CHANGED
@@ -288,6 +288,10 @@ class Chef
|
|
288
288
|
File.umask(umask) if umask
|
289
289
|
end
|
290
290
|
|
291
|
+
def set_cwd
|
292
|
+
Dir.chdir(cwd) if cwd
|
293
|
+
end
|
294
|
+
|
291
295
|
def initialize_ipc
|
292
296
|
@stdout_pipe, @stderr_pipe, @process_status_pipe = IO.pipe, IO.pipe, IO.pipe
|
293
297
|
@process_status_pipe.last.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
@@ -381,6 +385,7 @@ class Chef
|
|
381
385
|
set_group
|
382
386
|
set_environment
|
383
387
|
set_umask
|
388
|
+
set_cwd
|
384
389
|
|
385
390
|
begin
|
386
391
|
command.kind_of?(Array) ? exec(*command) : exec(command)
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/webui_user.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424247
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
9
|
- 14
|
10
|
-
-
|
10
|
+
- rc
|
11
11
|
- 1
|
12
|
-
version: 0.9.14.
|
12
|
+
version: 0.9.14.rc.1
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Adam Jacob
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-02-
|
20
|
+
date: 2011-02-25 00:00:00 -08:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -405,6 +405,7 @@ files:
|
|
405
405
|
- lib/chef/monkey_patches/dir.rb
|
406
406
|
- lib/chef/monkey_patches/string.rb
|
407
407
|
- lib/chef/monkey_patches/numeric.rb
|
408
|
+
- lib/chef/monkey_patches/regexp.rb
|
408
409
|
- lib/chef/monkey_patches/tempfile.rb
|
409
410
|
- lib/chef/shef.rb
|
410
411
|
- lib/chef/handler/json_file.rb
|
@@ -601,7 +602,7 @@ files:
|
|
601
602
|
- lib/chef/mixin/command.rb
|
602
603
|
- lib/chef/mixin/params_validate.rb
|
603
604
|
- lib/chef/mixin/language_include_attribute.rb
|
604
|
-
- lib/chef/
|
605
|
+
- lib/chef/json_compat.rb
|
605
606
|
- lib/chef/knife.rb
|
606
607
|
- lib/chef.rb
|
607
608
|
- bin/chef-client
|