diff options
author | Adam Leff <adam@leff.co> | 2016-11-28 17:10:09 -0500 |
---|---|---|
committer | Adam Leff <adam@leff.co> | 2016-11-28 17:11:34 -0500 |
commit | eceb6331fe91e070852c0aec1022e6f9d162623f (patch) | |
tree | 30fda8e457fde73ad0da47bccfc34a7d97a79fa0 /lib/chef/data_collector | |
parent | 8d4bb2231d45faaeaf14fb4bcd9587ba06461573 (diff) | |
download | chef-eceb6331fe91e070852c0aec1022e6f9d162623f.tar.gz |
Update Data Collector to use Chef::JSONCompat
Data Collector uses the json gem to read/write the metadata file
in the file cache. Let's change that to use Chef::JSONCompat instead.
Signed-off-by: Adam Leff <adam@leff.co>
Diffstat (limited to 'lib/chef/data_collector')
-rw-r--r-- | lib/chef/data_collector/messages.rb | 1 | ||||
-rw-r--r-- | lib/chef/data_collector/messages/helpers.rb | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/chef/data_collector/messages.rb b/lib/chef/data_collector/messages.rb index e0dfd6cb67..f63242f85e 100644 --- a/lib/chef/data_collector/messages.rb +++ b/lib/chef/data_collector/messages.rb @@ -18,7 +18,6 @@ # limitations under the License. # -require "json" require "securerandom" require_relative "messages/helpers" diff --git a/lib/chef/data_collector/messages/helpers.rb b/lib/chef/data_collector/messages/helpers.rb index c0c700f847..d257b74893 100644 --- a/lib/chef/data_collector/messages/helpers.rb +++ b/lib/chef/data_collector/messages/helpers.rb @@ -142,14 +142,14 @@ class Chef # @return [Hash] DataCollector metadata for this node # def metadata - JSON.load(Chef::FileCache.load(metadata_filename)) + Chef::JSONCompat.parse(Chef::FileCache.load(metadata_filename)) rescue Chef::Exceptions::FileNotFound {} end def update_metadata(key, value) updated_metadata = metadata.tap { |x| x[key] = value } - Chef::FileCache.store(metadata_filename, updated_metadata.to_json, 0644) + Chef::FileCache.store(metadata_filename, Chef::JSONCompat.to_json(updated_metadata), 0644) end def metadata_filename |