Permalink
Browse files

Fix CHEF-2057: renamed Chef::JSON to Chef::JSONCompat, so

"JSON" used in recipes uses the JSON gem, not Chef::JSON
(as recipes are run in the context of Chef::).
  • Loading branch information...
1 parent 43e99e0 commit 4ac29aa96e3efe86ca4a38c20d0e99d1d3787981 Tim Hinderliter committed Feb 16, 2011
Showing with 156 additions and 156 deletions.
  1. +3 −3 chef-server-api/app/controllers/application.rb
  2. +1 −1 chef-server-api/config/router.rb
  3. +2 −2 chef-server-webui/app/controllers/databag_items.rb
  4. +3 −3 chef-server-webui/app/controllers/nodes.rb
  5. +4 −4 chef-server-webui/app/controllers/roles.rb
  6. +1 −1 chef/lib/chef/api_client.rb
  7. +1 −1 chef/lib/chef/application/client.rb
  8. +1 −1 chef/lib/chef/application/solo.rb
  9. +2 −2 chef/lib/chef/cookbook/metadata.rb
  10. +1 −1 chef/lib/chef/couchdb.rb
  11. +1 −1 chef/lib/chef/data_bag.rb
  12. +1 −1 chef/lib/chef/data_bag_item.rb
  13. +1 −1 chef/lib/chef/environment.rb
  14. +1 −1 chef/lib/chef/file_cache.rb
  15. +1 −1 chef/lib/chef/handler/json_file.rb
  16. +1 −1 chef/lib/chef/index_queue/consumer.rb
  17. +2 −2 chef/lib/chef/index_queue/indexable.rb
  18. +1 −1 chef/lib/chef/{json.rb → json_compat.rb}
  19. +6 −6 chef/lib/chef/knife.rb
  20. +1 −1 chef/lib/chef/knife/bluebox_images_list.rb
  21. +1 −1 chef/lib/chef/knife/bluebox_server_create.rb
  22. +1 −1 chef/lib/chef/knife/bluebox_server_delete.rb
  23. +1 −1 chef/lib/chef/knife/bluebox_server_list.rb
  24. +1 −1 chef/lib/chef/knife/bootstrap.rb
  25. +1 −1 chef/lib/chef/knife/client_bulk_delete.rb
  26. +1 −1 chef/lib/chef/knife/client_create.rb
  27. +1 −1 chef/lib/chef/knife/client_delete.rb
  28. +1 −1 chef/lib/chef/knife/client_edit.rb
  29. +1 −1 chef/lib/chef/knife/client_list.rb
  30. +1 −1 chef/lib/chef/knife/client_reregister.rb
  31. +1 −1 chef/lib/chef/knife/client_show.rb
  32. +1 −1 chef/lib/chef/knife/cookbook_create.rb
  33. +1 −1 chef/lib/chef/knife/cookbook_list.rb
  34. +1 −1 chef/lib/chef/knife/cookbook_metadata.rb
  35. +1 −1 chef/lib/chef/knife/cookbook_show.rb
  36. +1 −1 chef/lib/chef/knife/cookbook_site_share.rb
  37. +1 −1 chef/lib/chef/knife/cookbook_site_unshare.rb
  38. +1 −1 chef/lib/chef/knife/data_bag_from_file.rb
  39. +1 −1 chef/lib/chef/knife/ec2_instance_data.rb
  40. +1 −1 chef/lib/chef/knife/ec2_server_create.rb
  41. +1 −1 chef/lib/chef/knife/ec2_server_delete.rb
  42. +1 −1 chef/lib/chef/knife/ec2_server_list.rb
  43. +1 −1 chef/lib/chef/knife/environment_create.rb
  44. +1 −1 chef/lib/chef/knife/environment_delete.rb
  45. +1 −1 chef/lib/chef/knife/environment_edit.rb
  46. +1 −1 chef/lib/chef/knife/environment_list.rb
  47. +1 −1 chef/lib/chef/knife/environment_show.rb
  48. +1 −1 chef/lib/chef/knife/node_bulk_delete.rb
  49. +1 −1 chef/lib/chef/knife/node_create.rb
  50. +1 −1 chef/lib/chef/knife/node_delete.rb
  51. +1 −1 chef/lib/chef/knife/node_edit.rb
  52. +1 −1 chef/lib/chef/knife/node_from_file.rb
  53. +1 −1 chef/lib/chef/knife/node_list.rb
  54. +1 −1 chef/lib/chef/knife/node_run_list_add.rb
  55. +1 −1 chef/lib/chef/knife/node_run_list_remove.rb
  56. +1 −1 chef/lib/chef/knife/node_show.rb
  57. +1 −1 chef/lib/chef/knife/rackspace_server_create.rb
  58. +1 −1 chef/lib/chef/knife/rackspace_server_delete.rb
  59. +1 −1 chef/lib/chef/knife/rackspace_server_list.rb
  60. +1 −1 chef/lib/chef/knife/role_bulk_delete.rb
  61. +1 −1 chef/lib/chef/knife/role_create.rb
  62. +1 −1 chef/lib/chef/knife/role_delete.rb
  63. +1 −1 chef/lib/chef/knife/role_edit.rb
  64. +1 −1 chef/lib/chef/knife/role_from_file.rb
  65. +1 −1 chef/lib/chef/knife/role_list.rb
  66. +1 −1 chef/lib/chef/knife/role_show.rb
  67. +1 −1 chef/lib/chef/knife/slicehost_images_list.rb
  68. +1 −1 chef/lib/chef/knife/slicehost_server_create.rb
  69. +1 −1 chef/lib/chef/knife/slicehost_server_delete.rb
  70. +1 −1 chef/lib/chef/knife/slicehost_server_list.rb
  71. +1 −1 chef/lib/chef/knife/terremark_server_create.rb
  72. +1 −1 chef/lib/chef/knife/terremark_server_delete.rb
  73. +1 −1 chef/lib/chef/knife/terremark_server_list.rb
  74. +1 −1 chef/lib/chef/node.rb
  75. +1 −1 chef/lib/chef/openid_registration.rb
  76. +2 −2 chef/lib/chef/provider/deploy/revision.rb
  77. +7 −7 chef/lib/chef/rest.rb
  78. +2 −2 chef/lib/chef/role.rb
  79. +2 −2 chef/lib/chef/shef.rb
  80. +3 −3 chef/lib/chef/shef/ext.rb
  81. +2 −2 chef/lib/chef/solr_query/solr_http_request.rb
  82. +1 −1 chef/lib/chef/tasks/chef_repo.rake
  83. +1 −1 chef/lib/chef/webui_user.rb
  84. +1 −1 chef/spec/functional/tiny_server_spec.rb
  85. +1 −1 chef/spec/lib/chef/resource/zen_master.rb
  86. +1 −1 chef/spec/tiny_server.rb
  87. +1 −1 chef/spec/unit/api_client_spec.rb
  88. +2 −2 chef/spec/unit/application/client_spec.rb
  89. +2 −2 chef/spec/unit/application/solo_spec.rb
  90. +1 −1 chef/spec/unit/checksum_spec.rb
  91. +2 −2 chef/spec/unit/cookbook/metadata_spec.rb
  92. +1 −1 chef/spec/unit/data_bag_item_spec.rb
  93. +1 −1 chef/spec/unit/data_bag_spec.rb
  94. +1 −1 chef/spec/unit/environment_spec.rb
  95. +1 −1 chef/spec/unit/handler/json_file_spec.rb
  96. +4 −4 chef/spec/unit/index_queue_spec.rb
  97. +1 −1 chef/spec/unit/knife/cookbook_metadata_from_file_spec.rb
  98. +1 −1 chef/spec/unit/knife/data_bag_show_spec.rb
  99. +3 −3 chef/spec/unit/node_spec.rb
  100. +1 −1 chef/spec/unit/openid_registration_spec.rb
  101. +1 −1 chef/spec/unit/resource_collection_spec.rb
  102. +1 −1 chef/spec/unit/resource_spec.rb
  103. +1 −1 chef/spec/unit/rest_spec.rb
  104. +3 −3 chef/spec/unit/role_spec.rb
  105. +3 −3 chef/spec/unit/webui_user_spec.rb
  106. +1 −1 features/data/Rakefile
  107. +1 −1 features/data/node-load-test.rb
  108. +1 −1 features/steps/deploy_steps.rb
  109. +2 −2 features/steps/fixture_steps.rb
  110. +4 −4 features/steps/response_steps.rb
  111. +3 −3 features/support/couchdb_replicate.rb
@@ -22,7 +22,7 @@
require "chef/mixin/checksum"
require "chef/cookbook_loader"
require "mixlib/authentication/signatureverification"
-require "chef/json"
+require 'chef/json_compat'
class Application < Merb::Controller
@@ -124,13 +124,13 @@ def get_available_recipes
# accept headers and the type passed into Merb::Controller.display
#--
# TODO: tim, 2010-11-24: would be nice to instead have Merb call
- # Chef::JSON.to_json, instead of obj.to_json, but changing that
+ # Chef::JSONCompat.to_json, instead of obj.to_json, but changing that
# behavior is convoluted in Merb. This override is assuming that
# Merb is eventually calling obj.to_json, which takes the :max_nesting
# option.
override! :display
def display(obj)
- super(obj, nil, {:max_nesting => Chef::JSON::JSON_MAX_NESTING})
+ super(obj, nil, {:max_nesting => Chef::JSONCompat::JSON_MAX_NESTING})
end
end
@@ -134,7 +134,7 @@ def json_params
begin
# Call Chef's JSON utility instead of the default in Merb,
# JSON.parse.
- jobj = Chef::JSON.from_json(raw_post)
+ jobj = Chef::JSONCompat.from_json(raw_post)
jobj = jobj.to_mash if jobj.is_a?(Hash)
rescue JSON::ParserError
jobj = Mash.new
@@ -38,7 +38,7 @@ def update
begin
@databag_item = Chef::DataBagItem.new
@databag_item.data_bag params[:databag_id]
- @databag_item.raw_data = Chef::JSON.from_json(params[:json_data])
+ @databag_item.raw_data = Chef::JSONCompat.from_json(params[:json_data])
raise ArgumentError, "Updating id is not allowed" unless @databag_item.raw_data['id'] == params[:id] #to be consistent with other objects, changing id is not allowed.
@databag_item.save
redirect(url(:databag_databag_items, :databag_id => params[:databag_id], :id => @databag_item.name), :message => { :notice => "Updated Databag Item #{@databag_item.name}" })
@@ -61,7 +61,7 @@ def create
@databag_name = params[:databag_id]
@databag_item = Chef::DataBagItem.new
@databag_item.data_bag @databag_name
- @databag_item.raw_data = Chef::JSON.from_json(params[:json_data])
+ @databag_item.raw_data = Chef::JSONCompat.from_json(params[:json_data])
@databag_item.create
redirect(url(:databag_databag_items, :databag_id => @databag_name), :message => { :notice => "Databag item created successfully" })
rescue => e
@@ -95,14 +95,14 @@ def create
@node = Chef::Node.new
@node.name params[:name]
@node.chef_environment params[:chef_environment]
- @node.normal_attrs = Chef::JSON.from_json(params[:attributes])
+ @node.normal_attrs = Chef::JSONCompat.from_json(params[:attributes])
@node.run_list.reset!(params[:for_node] ? params[:for_node] : [])
raise ArgumentError, "Node name cannot be blank" if (params[:name].nil? || params[:name].length==0)
@node.create
redirect(url(:nodes), :message => { :notice => "Created Node #{@node.name}" })
rescue => e
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
- @node.normal_attrs = Chef::JSON.from_json(params[:attributes])
+ @node.normal_attrs = Chef::JSONCompat.from_json(params[:attributes])
@available_recipes = list_available_recipes_for(@node.chef_environment)
@available_roles = Chef::Role.list.keys.sort
@node.run_list params[:for_node]
@@ -117,7 +117,7 @@ def update
@node = Chef::Node.load(params[:id])
@node.chef_environment(params[:chef_environment])
@node.run_list.reset!(params[:for_node] ? params[:for_node] : [])
- @node.normal_attrs = Chef::JSON.from_json(params[:attributes])
+ @node.normal_attrs = Chef::JSONCompat.from_json(params[:attributes])
@node.save
@_message = { :notice => "Updated Node" }
render :show
@@ -100,8 +100,8 @@ def create
@role.name(params[:name])
@role.env_run_lists(params[:env_run_lists])
@role.description(params[:description]) if params[:description] != ''
- @role.default_attributes(Chef::JSON.from_json(params[:default_attributes])) if params[:default_attributes] != ''
- @role.override_attributes(Chef::JSON.from_json(params[:override_attributes])) if params[:override_attributes] != ''
+ @role.default_attributes(Chef::JSONCompat.from_json(params[:default_attributes])) if params[:default_attributes] != ''
+ @role.override_attributes(Chef::JSONCompat.from_json(params[:override_attributes])) if params[:override_attributes] != ''
@role.create
redirect(url(:roles), :message => { :notice => "Created Role #{@role.name}" })
rescue => e
@@ -116,8 +116,8 @@ def update
@role = Chef::Role.load(params[:id])
@role.env_run_lists(params[:env_run_lists])
@role.description(params[:description]) if params[:description] != ''
- @role.default_attributes(Chef::JSON.from_json(params[:default_attributes])) if params[:default_attributes] != ''
- @role.override_attributes(Chef::JSON.from_json(params[:override_attributes])) if params[:override_attributes] != ''
+ @role.default_attributes(Chef::JSONCompat.from_json(params[:default_attributes])) if params[:default_attributes] != ''
+ @role.override_attributes(Chef::JSONCompat.from_json(params[:override_attributes])) if params[:override_attributes] != ''
@role.save
redirect(url(:role, params[:id]), :message => { :notice => "Updated Role" })
rescue => e
@@ -24,7 +24,7 @@
require 'chef/certificate'
require 'chef/index_queue'
require 'extlib'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class ApiClient
@@ -181,7 +181,7 @@ def reconfigure
end
begin
- @chef_client_json = Chef::JSON.from_json(json_io.read)
+ @chef_client_json = Chef::JSONCompat.from_json(json_io.read)
json_io.close unless json_io.closed?
rescue JSON::ParserError => error
Chef::Application.fatal!("Could not parse the provided JSON file (#{Chef::Config[:json_attribs]})!: " + error.message, 2)
@@ -145,7 +145,7 @@ def reconfigure
end
begin
- @chef_solo_json = Chef::JSON.from_json(json_io.read)
+ @chef_solo_json = Chef::JSONCompat.from_json(json_io.read)
json_io.close unless json_io.closed?
rescue JSON::ParserError => error
Chef::Application.fatal!("Could not parse the provided JSON file (#{Chef::Config[:json_attribs]})!: " + error.message, 2)
@@ -437,12 +437,12 @@ def from_hash(o)
end
def self.from_json(string)
- o = Chef::JSON.from_json(string)
+ o = Chef::JSONCompat.from_json(string)
self.from_hash(o)
end
def from_json(string)
- o = Chef::JSON.from_json(string)
+ o = Chef::JSONCompat.from_json(string)
from_hash(o)
end
View
@@ -21,7 +21,7 @@
require 'chef/rest'
require 'chef/log'
require 'digest/sha2'
-require 'chef/json'
+require 'chef/json_compat'
# We want to fail on create if uuidtools isn't installed
begin
@@ -25,7 +25,7 @@
require 'chef/data_bag_item'
require 'chef/index_queue'
require 'extlib'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class DataBag
@@ -27,7 +27,7 @@
require 'chef/index_queue'
require 'chef/data_bag'
require 'extlib'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class DataBagItem
@@ -181,7 +181,7 @@ def update_from_params(params)
end
unless params[:attributes].nil? || params[:attributes].size == 0
- attributes(Chef::JSON.from_json(params[:attributes]))
+ attributes(Chef::JSONCompat.from_json(params[:attributes]))
end
valid = validate_required_attrs_present && valid
@@ -18,7 +18,7 @@
require 'chef/mixin/params_validate'
require 'chef/mixin/create_path'
require 'chef/exceptions'
-require 'chef/json'
+require 'chef/json_compat'
require 'fileutils'
class Chef
@@ -41,7 +41,7 @@ def report
build_report_dir
savetime = Time.now.strftime("%Y%m%d%H%M%S")
File.open(File.join(config[:path], "chef-run-report-#{savetime}.json"), "w") do |file|
- file.puts Chef::JSON.to_json_pretty(data)
+ file.puts Chef::JSONCompat.to_json_pretty(data)
end
end
@@ -56,7 +56,7 @@ def run
alias :start :run
def call_action_for_message(message)
- amqp_payload = Chef::JSON.from_json(message[:payload], :create_additions => false, :max_nesting => false)
+ amqp_payload = Chef::JSONCompat.from_json(message[:payload], :create_additions => false, :max_nesting => false)
action = amqp_payload["action"].to_sym
app_payload = amqp_payload["payload"]
assert_method_whitelisted(action)
@@ -17,7 +17,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/json'
+require 'chef/json_compat'
class Chef
module IndexQueue
@@ -93,7 +93,7 @@ def publish_object(object_id, object)
begin
publisher.amqp_client.tx_select if Chef::Config[:persistent_queue]
publisher.queue_for_object(object_id) do |queue|
- queue.publish(Chef::JSON.to_json(object), :persistent => Chef::Config[:persistent_queue])
+ queue.publish(Chef::JSONCompat.to_json(object), :persistent => Chef::Config[:persistent_queue])
end
publisher.amqp_client.tx_commit if Chef::Config[:persistent_queue]
rescue
@@ -20,7 +20,7 @@
require 'json'
class Chef
- class JSON
+ class JSONCompat
JSON_MAX_NESTING = 1000
class <<self
View
@@ -298,7 +298,7 @@ def pretty_print(data)
def output(data)
case config[:format]
when "json", nil
- stdout.puts Chef::JSON.to_json_pretty(data)
+ stdout.puts Chef::JSONCompat.to_json_pretty(data)
when "yaml"
require 'yaml'
stdout.puts YAML::dump(data)
@@ -362,7 +362,7 @@ def format_cookbook_list_for_display(item)
end
def edit_data(data, parse_output=true)
- output = Chef::JSON.to_json_pretty(data)
+ output = Chef::JSONCompat.to_json_pretty(data)
if (!config[:no_editor])
filename = "knife-edit-"
@@ -380,7 +380,7 @@ def edit_data(data, parse_output=true)
File.unlink(filename)
end
- parse_output ? Chef::JSON.from_json(output) : output
+ parse_output ? Chef::JSONCompat.from_json(output) : output
end
def confirm(question, append_instructions=true)
@@ -433,7 +433,7 @@ def load_from_file(klass, from_file, bag=nil)
case from_file
when /\.(js|json)$/
- Chef::JSON.from_json(IO.read(filename))
+ Chef::JSONCompat.from_json(IO.read(filename))
when /\.rb$/
r = klass.new
r.from_file(filename)
@@ -463,8 +463,8 @@ def edit_object(klass, name)
# We wouldn't have to do these shenanigans if all the editable objects
# implemented to_hash, or if to_json against a hash returned a string
# with stable key order.
- object_parsed_again = Chef::JSON.from_json(Chef::JSON.to_json(object), :create_additions => false)
- output_parsed_again = Chef::JSON.from_json(Chef::JSON.to_json(output), :create_additions => false)
+ object_parsed_again = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(object), :create_additions => false)
+ output_parsed_again = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(output), :create_additions => false)
if object_parsed_again != output_parsed_again
output.save
self.msg("Saved #{output}")
@@ -17,7 +17,7 @@
#
require 'chef/knife'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -17,7 +17,7 @@
#
require 'chef/knife'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -17,7 +17,7 @@
#
require 'chef/knife'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -17,7 +17,7 @@
#
require 'chef/knife'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -17,7 +17,7 @@
#
require 'chef/knife'
-require 'chef/json'
+require 'chef/json_compat'
require 'tempfile'
require 'erubis'
@@ -18,7 +18,7 @@
require 'chef/knife'
require 'chef/api_client'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -18,7 +18,7 @@
require 'chef/knife'
require 'chef/api_client'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -18,7 +18,7 @@
require 'chef/knife'
require 'chef/api_client'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -18,7 +18,7 @@
require 'chef/knife'
require 'chef/api_client'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -18,7 +18,7 @@
require 'chef/knife'
require 'chef/api_client'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -18,7 +18,7 @@
require 'chef/knife'
require 'chef/api_client'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -18,7 +18,7 @@
require 'chef/knife'
require 'chef/api_client'
-require 'chef/json'
+require 'chef/json_compat'
class Chef
class Knife
@@ -17,7 +17,7 @@
#
require 'chef/knife'
-require 'chef/json'
+require 'chef/json_compat'
require 'uri'
require 'chef/mixin/shell_out'
Oops, something went wrong.

0 comments on commit 4ac29aa

Please sign in to comment.