summaryrefslogtreecommitdiff
path: root/chef/lib/chef/knife.rb
diff options
context:
space:
mode:
authorTim Hinderliter <tim@opscode.com>2011-02-16 12:35:53 -0800
committerTim Hinderliter <tim@opscode.com>2011-02-16 12:35:53 -0800
commit4ac29aa96e3efe86ca4a38c20d0e99d1d3787981 (patch)
tree618b6f643d4f8fb02a37a8710ce6d9a7eb8541f4 /chef/lib/chef/knife.rb
parent43e99e08b667f8b3623a7e950829fc38c13cd551 (diff)
downloadchef-4ac29aa96e3efe86ca4a38c20d0e99d1d3787981.tar.gz
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::).
Diffstat (limited to 'chef/lib/chef/knife.rb')
-rw-r--r--chef/lib/chef/knife.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/chef/lib/chef/knife.rb b/chef/lib/chef/knife.rb
index 810dd9e164..8bb9e45390 100644
--- a/chef/lib/chef/knife.rb
+++ b/chef/lib/chef/knife.rb
@@ -298,7 +298,7 @@ class Chef
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 @@ class Chef
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 @@ class Chef
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 @@ class Chef
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 @@ class Chef
# 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}")