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");
1517# See the License for the specific language governing permissions and
1618# limitations under the License.
1719#
20+ require 'chef/json'
1821
1922class Chef
2023module IndexQueue
@@ -67,7 +70,8 @@ def add_to_index(metadata={})
6770object_with_metadata = with_indexer_metadata ( metadata )
6871obj_id = object_with_metadata [ "id" ]
6972AmqpClient . 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 ) )
7175end
7276end
7377
@@ -76,7 +80,8 @@ def delete_from_index(metadata={})
7680object_with_metadata = with_indexer_metadata ( metadata )
7781obj_id = object_with_metadata [ "id" ]
7882AmqpClient . 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 ) )
8085end
8186end
8287
0 commit comments