Skip to content

Commit 4422203

Browse files
author
Seth Falcon
committed
Use Chef::JSON.to_json in Chef::IndexQueue PL-538
1 parent 65f1312 commit 4422203

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎chef/lib/chef/index_queue/indexable.rb‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#
22
# Author:: Daniel DeLeo (<[email protected]>)
3+
# Author:: Seth Falcon (<[email protected]>)
34
# Copyright:: Copyright (c) 2009 Daniel DeLeo
5+
# Copyright:: Copyright (c) 2010 Opscode, Inc.
46
# License:: Apache License, Version 2.0
57
#
68
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,6 +17,7 @@
1517
# See the License for the specific language governing permissions and
1618
# limitations under the License.
1719
#
20+
require'chef/json'
1821

1922
classChef
2023
moduleIndexQueue
@@ -67,7 +70,8 @@ def add_to_index(metadata={})
6770
object_with_metadata=with_indexer_metadata(metadata)
6871
obj_id=object_with_metadata["id"]
6972
AmqpClient.instance.queue_for_object(obj_id)do |queue|
70-
queue.publish({:action=>:add,:payload=>self.with_indexer_metadata(metadata)}.to_json)
73+
obj={:action=>:add,:payload=>self.with_indexer_metadata(metadata)}
74+
queue.publish(Chef::JSON.to_json(obj))
7175
end
7276
end
7377

@@ -76,7 +80,8 @@ def delete_from_index(metadata={})
7680
object_with_metadata=with_indexer_metadata(metadata)
7781
obj_id=object_with_metadata["id"]
7882
AmqpClient.instance.queue_for_object(obj_id)do |queue|
79-
queue.publish({:action=>:delete,:payload=>self.with_indexer_metadata(metadata)}.to_json)
83+
obj={:action=>:delete,:payload=>self.with_indexer_metadata(metadata)}
84+
queue.publish(Chef::JSON.to_json(obj))
8085
end
8186
end
8287

0 commit comments

Comments
(0)