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.
Files changed (86) hide show
  1. data/lib/chef/api_client.rb +1 -1
  2. data/lib/chef/application/client.rb +1 -1
  3. data/lib/chef/application/solo.rb +1 -1
  4. data/lib/chef/checksum_cache.rb +1 -1
  5. data/lib/chef/cookbook/metadata.rb +2 -2
  6. data/lib/chef/couchdb.rb +1 -1
  7. data/lib/chef/data_bag.rb +1 -1
  8. data/lib/chef/data_bag_item.rb +1 -1
  9. data/lib/chef/exceptions.rb +1 -0
  10. data/lib/chef/file_cache.rb +1 -1
  11. data/lib/chef/handler/json_file.rb +1 -1
  12. data/lib/chef/index_queue/amqp_client.rb +1 -1
  13. data/lib/chef/index_queue/consumer.rb +1 -1
  14. data/lib/chef/index_queue/indexable.rb +0 -1
  15. data/lib/chef/{json.rb → json_compat.rb} +1 -1
  16. data/lib/chef/knife.rb +6 -6
  17. data/lib/chef/knife/bluebox_images_list.rb +1 -1
  18. data/lib/chef/knife/bluebox_server_create.rb +1 -1
  19. data/lib/chef/knife/bluebox_server_delete.rb +1 -1
  20. data/lib/chef/knife/bluebox_server_list.rb +1 -1
  21. data/lib/chef/knife/bootstrap.rb +1 -1
  22. data/lib/chef/knife/client_bulk_delete.rb +1 -1
  23. data/lib/chef/knife/client_create.rb +1 -1
  24. data/lib/chef/knife/client_delete.rb +1 -1
  25. data/lib/chef/knife/client_edit.rb +1 -1
  26. data/lib/chef/knife/client_list.rb +1 -1
  27. data/lib/chef/knife/client_reregister.rb +1 -1
  28. data/lib/chef/knife/client_show.rb +1 -1
  29. data/lib/chef/knife/cookbook_create.rb +1 -1
  30. data/lib/chef/knife/cookbook_list.rb +1 -1
  31. data/lib/chef/knife/cookbook_metadata.rb +1 -1
  32. data/lib/chef/knife/cookbook_show.rb +1 -1
  33. data/lib/chef/knife/cookbook_site_share.rb +1 -1
  34. data/lib/chef/knife/cookbook_site_unshare.rb +1 -0
  35. data/lib/chef/knife/data_bag_delete.rb +1 -0
  36. data/lib/chef/knife/data_bag_from_file.rb +1 -0
  37. data/lib/chef/knife/ec2_instance_data.rb +1 -1
  38. data/lib/chef/knife/ec2_server_create.rb +2 -2
  39. data/lib/chef/knife/ec2_server_delete.rb +1 -1
  40. data/lib/chef/knife/ec2_server_list.rb +1 -1
  41. data/lib/chef/knife/node_bulk_delete.rb +1 -1
  42. data/lib/chef/knife/node_create.rb +1 -1
  43. data/lib/chef/knife/node_delete.rb +1 -1
  44. data/lib/chef/knife/node_edit.rb +1 -1
  45. data/lib/chef/knife/node_from_file.rb +1 -1
  46. data/lib/chef/knife/node_list.rb +1 -1
  47. data/lib/chef/knife/node_run_list_add.rb +1 -1
  48. data/lib/chef/knife/node_run_list_remove.rb +1 -1
  49. data/lib/chef/knife/node_show.rb +1 -1
  50. data/lib/chef/knife/rackspace_server_create.rb +1 -1
  51. data/lib/chef/knife/rackspace_server_delete.rb +1 -1
  52. data/lib/chef/knife/rackspace_server_list.rb +1 -1
  53. data/lib/chef/knife/role_bulk_delete.rb +1 -1
  54. data/lib/chef/knife/role_create.rb +1 -1
  55. data/lib/chef/knife/role_delete.rb +1 -1
  56. data/lib/chef/knife/role_edit.rb +1 -1
  57. data/lib/chef/knife/role_from_file.rb +1 -1
  58. data/lib/chef/knife/role_list.rb +1 -1
  59. data/lib/chef/knife/role_show.rb +1 -1
  60. data/lib/chef/knife/slicehost_images_list.rb +1 -1
  61. data/lib/chef/knife/slicehost_server_create.rb +1 -1
  62. data/lib/chef/knife/slicehost_server_delete.rb +1 -1
  63. data/lib/chef/knife/slicehost_server_list.rb +1 -1
  64. data/lib/chef/knife/terremark_server_create.rb +1 -1
  65. data/lib/chef/knife/terremark_server_delete.rb +1 -1
  66. data/lib/chef/knife/terremark_server_list.rb +1 -1
  67. data/lib/chef/log.rb +10 -5
  68. data/lib/chef/monkey_patches/regexp.rb +34 -0
  69. data/lib/chef/node.rb +1 -1
  70. data/lib/chef/openid_registration.rb +1 -1
  71. data/lib/chef/provider/deploy/revision.rb +5 -1
  72. data/lib/chef/provider/erl_call.rb +19 -3
  73. data/lib/chef/provider/package/apt.rb +1 -1
  74. data/lib/chef/provider/package/yum.rb +29 -3
  75. data/lib/chef/provider/service/simple.rb +1 -1
  76. data/lib/chef/resource/solaris_package.rb +1 -0
  77. data/lib/chef/resource/yum_package.rb +1 -0
  78. data/lib/chef/rest.rb +12 -11
  79. data/lib/chef/role.rb +2 -2
  80. data/lib/chef/shef.rb +4 -3
  81. data/lib/chef/shef/ext.rb +3 -2
  82. data/lib/chef/shell_out.rb +5 -0
  83. data/lib/chef/tasks/chef_repo.rake +1 -1
  84. data/lib/chef/version.rb +1 -1
  85. data/lib/chef/webui_user.rb +1 -1
  86. metadata +6 -5
@@ -24,7 +24,7 @@ require 'chef/couchdb'
24
24
  require 'chef/certificate'
25
25
  require 'chef/index_queue'
26
26
  require 'extlib'
27
- require 'chef/json'
27
+ require 'chef/json_compat'
28
28
 
29
29
  class Chef
30
30
  class ApiClient
@@ -181,7 +181,7 @@ class Chef::Application::Client < Chef::Application
181
181
  end
182
182
 
183
183
  begin
184
- @chef_client_json = Chef::JSON.from_json(json_io.read)
184
+ @chef_client_json = Chef::JSONCompat.from_json(json_io.read)
185
185
  json_io.close unless json_io.closed?
186
186
  rescue JSON::ParserError => error
187
187
  Chef::Application.fatal!("Could not parse the provided JSON file (#{Chef::Config[:json_attribs]})!: " + error.message, 2)
@@ -145,7 +145,7 @@ class Chef::Application::Solo < Chef::Application
145
145
  end
146
146
 
147
147
  begin
148
- @chef_solo_json = Chef::JSON.from_json(json_io.read)
148
+ @chef_solo_json = Chef::JSONCompat.from_json(json_io.read)
149
149
  json_io.close unless json_io.closed?
150
150
  rescue JSON::ParserError => error
151
151
  Chef::Application.fatal!("Could not parse the provided JSON file (#{Chef::Config[:json_attribs]})!: " + error.message, 2)
@@ -151,7 +151,7 @@ class Chef
151
151
  end
152
152
 
153
153
  def checksum_file(file, digest)
154
- File.open(file) { |f| checksum_io(f, digest) }
154
+ File.open(file, 'rb') { |f| checksum_io(f, digest) }
155
155
  end
156
156
 
157
157
  def checksum_io(io, digest)
@@ -430,12 +430,12 @@ class Chef
430
430
  end
431
431
 
432
432
  def self.from_json(string)
433
- o = Chef::JSON.from_json(string)
433
+ o = Chef::JSONCompat.from_json(string)
434
434
  self.from_hash(o)
435
435
  end
436
436
 
437
437
  def from_json(string)
438
- o = Chef::JSON.from_json(string)
438
+ o = Chef::JSONCompat.from_json(string)
439
439
  from_hash(o)
440
440
  end
441
441
 
@@ -21,7 +21,7 @@ require 'chef/config'
21
21
  require 'chef/rest'
22
22
  require 'chef/log'
23
23
  require 'digest/sha2'
24
- require 'chef/json'
24
+ require 'chef/json_compat'
25
25
 
26
26
  # We want to fail on create if uuidtools isn't installed
27
27
  begin
@@ -25,7 +25,7 @@ require 'chef/couchdb'
25
25
  require 'chef/data_bag_item'
26
26
  require 'chef/index_queue'
27
27
  require 'extlib'
28
- require 'chef/json'
28
+ require 'chef/json_compat'
29
29
 
30
30
  class Chef
31
31
  class DataBag
@@ -27,7 +27,7 @@ require 'chef/couchdb'
27
27
  require 'chef/index_queue'
28
28
  require 'chef/data_bag'
29
29
  require 'extlib'
30
- require 'chef/json'
30
+ require 'chef/json_compat'
31
31
 
32
32
  class Chef
33
33
  class DataBagItem
@@ -24,6 +24,7 @@ class Chef
24
24
  class Cron < RuntimeError; end
25
25
  class Env < RuntimeError; end
26
26
  class Exec < RuntimeError; end
27
+ class ErlCall < RuntimeError; end
27
28
  class FileNotFound < RuntimeError; end
28
29
  class Package < RuntimeError; end
29
30
  class Service < RuntimeError; end
@@ -18,7 +18,7 @@
18
18
  require 'chef/mixin/params_validate'
19
19
  require 'chef/mixin/create_path'
20
20
  require 'chef/exceptions'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
  require 'fileutils'
23
23
 
24
24
  class Chef
@@ -41,7 +41,7 @@ class Chef
41
41
  build_report_dir
42
42
  savetime = Time.now.strftime("%Y%m%d%H%M%S")
43
43
  File.open(File.join(config[:path], "chef-run-report-#{savetime}.json"), "w") do |file|
44
- file.puts Chef::JSON.to_json_pretty(data)
44
+ file.puts Chef::JSONCompat.to_json_pretty(data)
45
45
  end
46
46
  end
47
47
 
@@ -76,7 +76,7 @@ class Chef
76
76
  def send_action(action, data)
77
77
  retries = 0
78
78
  begin
79
- exchange.publish(Chef::JSON.to_json({"action" => action.to_s, "payload" => data}))
79
+ exchange.publish(Chef::JSONCompat.to_json({"action" => action.to_s, "payload" => data}))
80
80
  rescue Bunny::ServerDownError, Bunny::ConnectionError, Errno::ECONNRESET
81
81
  disconnected!
82
82
  if (retries += 1) < 2
@@ -56,7 +56,7 @@ class Chef
56
56
  alias :start :run
57
57
 
58
58
  def call_action_for_message(message)
59
- amqp_payload = Chef::JSON.from_json(message[:payload], :create_additions => false, :max_nesting => false)
59
+ amqp_payload = Chef::JSONCompat.from_json(message[:payload], :create_additions => false, :max_nesting => false)
60
60
  action = amqp_payload["action"].to_sym
61
61
  app_payload = amqp_payload["payload"]
62
62
  assert_method_whitelisted(action)
@@ -70,7 +70,6 @@ class Chef
70
70
  Chef::Log.debug("pushing item to index queue for deletion: #{self.with_indexer_metadata(metadata)}")
71
71
  AmqpClient.instance.send_action(:delete, self.with_indexer_metadata(metadata))
72
72
  end
73
-
74
73
  end
75
74
  end
76
75
  end
@@ -20,7 +20,7 @@
20
20
  require 'json'
21
21
 
22
22
  class Chef
23
- class JSON
23
+ class JSONCompat
24
24
  JSON_MAX_NESTING = 1000
25
25
 
26
26
  class <<self
@@ -284,7 +284,7 @@ class Chef
284
284
  def output(data)
285
285
  case config[:format]
286
286
  when "json", nil
287
- stdout.puts Chef::JSON.to_json_pretty(data)
287
+ stdout.puts Chef::JSONCompat.to_json_pretty(data)
288
288
  when "yaml"
289
289
  require 'yaml'
290
290
  stdout.puts YAML::dump(data)
@@ -330,7 +330,7 @@ class Chef
330
330
  end
331
331
 
332
332
  def edit_data(data, parse_output=true)
333
- output = Chef::JSON.to_json_pretty(data)
333
+ output = Chef::JSONCompat.to_json_pretty(data)
334
334
 
335
335
  if (!config[:no_editor])
336
336
  filename = "knife-edit-"
@@ -348,7 +348,7 @@ class Chef
348
348
  File.unlink(filename)
349
349
  end
350
350
 
351
- parse_output ? Chef::JSON.from_json(output) : output
351
+ parse_output ? Chef::JSONCompat.from_json(output) : output
352
352
  end
353
353
 
354
354
  def confirm(question, append_instructions=true)
@@ -399,7 +399,7 @@ class Chef
399
399
 
400
400
  case from_file
401
401
  when /\.(js|json)$/
402
- Chef::JSON.from_json(IO.read(filename))
402
+ Chef::JSONCompat.from_json(IO.read(filename))
403
403
  when /\.rb$/
404
404
  r = klass.new
405
405
  r.from_file(filename)
@@ -429,8 +429,8 @@ class Chef
429
429
  # We wouldn't have to do these shenanigans if all the editable objects
430
430
  # implemented to_hash, or if to_json against a hash returned a string
431
431
  # with stable key order.
432
- object_parsed_again = Chef::JSON.from_json(Chef::JSON.to_json(object), :create_additions => false)
433
- output_parsed_again = Chef::JSON.from_json(Chef::JSON.to_json(output), :create_additions => false)
432
+ object_parsed_again = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(object), :create_additions => false)
433
+ output_parsed_again = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(output), :create_additions => false)
434
434
  if object_parsed_again != output_parsed_again
435
435
  output.save
436
436
  self.msg("Saved #{output}")
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
 
22
22
  class Chef
23
23
  class Knife
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
 
22
22
  class Chef
23
23
  class Knife
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
 
22
22
  class Chef
23
23
  class Knife
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
 
22
22
  class Chef
23
23
  class Knife
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
  require 'tempfile'
22
22
  require 'erubis'
23
23
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  require 'chef/knife'
20
20
  require 'chef/api_client'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -18,7 +18,7 @@
18
18
 
19
19
  require 'chef/knife'
20
20
  require 'chef/api_client'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -18,7 +18,7 @@
18
18
 
19
19
  require 'chef/knife'
20
20
  require 'chef/api_client'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -18,7 +18,7 @@
18
18
 
19
19
  require 'chef/knife'
20
20
  require 'chef/api_client'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -18,7 +18,7 @@
18
18
 
19
19
  require 'chef/knife'
20
20
  require 'chef/api_client'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -18,7 +18,7 @@
18
18
 
19
19
  require 'chef/knife'
20
20
  require 'chef/api_client'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -18,7 +18,7 @@
18
18
 
19
19
  require 'chef/knife'
20
20
  require 'chef/api_client'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
  require 'uri'
22
22
  require 'chef/mixin/shell_out'
23
23
 
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
 
22
22
  class Chef
23
23
  class Knife
@@ -69,7 +69,7 @@ class Chef
69
69
  md.from_file(file)
70
70
  json_file = File.join(File.dirname(file), 'metadata.json')
71
71
  File.open(json_file, "w") do |f|
72
- f.write(Chef::JSON.to_json_pretty(md))
72
+ f.write(Chef::JSONCompat.to_json_pretty(md))
73
73
  end
74
74
  generated = true
75
75
  Chef::Log.debug("Generated #{json_file}")
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
  require 'uri'
22
22
 
23
23
  class Chef
@@ -85,7 +85,7 @@ class Chef
85
85
  :cookbook => category_string
86
86
  })
87
87
 
88
- res = Chef::JSON.from_json(http_resp.body)
88
+ res = Chef::JSONCompat.from_json(http_resp.body)
89
89
  if http_resp.code.to_i != 201
90
90
  if res['error_messages']
91
91
  if res['error_messages'][0] =~ /Version already exists/
@@ -18,6 +18,7 @@
18
18
  #
19
19
 
20
20
  require 'chef/knife'
21
+ require 'chef/json_compat'
21
22
 
22
23
  class Chef
23
24
  class Knife
@@ -18,6 +18,7 @@
18
18
 
19
19
  require 'chef/knife'
20
20
  require 'chef/data_bag'
21
+ require 'chef/json_compat'
21
22
 
22
23
  class Chef
23
24
  class Knife
@@ -19,6 +19,7 @@
19
19
  require 'chef/knife'
20
20
  require 'chef/data_bag'
21
21
  require 'chef/data_bag_item'
22
+ require 'chef/json_compat'
22
23
 
23
24
  class Chef
24
25
  class Knife
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
 
22
22
  class Chef
23
23
  class Knife
@@ -18,7 +18,7 @@
18
18
 
19
19
  require 'socket'
20
20
  require 'chef/knife'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -155,7 +155,7 @@ class Chef
155
155
  :groups => config[:security_groups],
156
156
  :flavor_id => config[:flavor],
157
157
  :key_name => Chef::Config[:knife][:aws_ssh_key_id],
158
- :availability_zone => Chef::Config[:availability_zone]
158
+ :availability_zone => Chef::Config[:knife][:availability_zone]
159
159
  )
160
160
 
161
161
  puts "#{h.color("Instance ID", :cyan)}: #{server.id}"
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
 
22
22
  class Chef
23
23
  class Knife
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  require 'chef/knife'
20
- require 'chef/json'
20
+ require 'chef/json_compat'
21
21
 
22
22
  class Chef
23
23
  class Knife
@@ -18,7 +18,7 @@
18
18
 
19
19
  require 'chef/knife'
20
20
  require 'chef/node'
21
- require 'chef/json'
21
+ require 'chef/json_compat'
22
22
 
23
23
  class Chef
24
24
  class Knife