Commit 1f3120f8 authored by Daniel DeLeo's avatar Daniel DeLeo
Browse files

gracefully handle non-standard (no dashes) UUIDs

parent e0bb0f7f
......@@ -75,7 +75,7 @@ class Chef
end
def queue_for_object(obj_id)
vnode_tag = UUIDTools::UUID.parse(obj_id).to_i % VNODES
vnode_tag = obj_id_to_int(obj_id) % VNODES
queue = amqp_client.queue("vnode-#{vnode_tag}")
retries = 0
begin
......@@ -93,6 +93,15 @@ class Chef
end
private
# Sometimes object ids are "proper" UUIDs, like "64bc00eb-120b-b6a2-ec0e-34fc90d151be"
# and sometimes they omit the dashes, like "64bc00eb120bb6a2ec0e34fc90d151be"
# UUIDTools uses different methods to parse the different styles.
def obj_id_to_int(obj_id)
UUIDTools::UUID.parse(obj_id).to_i
rescue ArgumentError
UUIDTools::UUID.parse_hexdigest(obj_id).to_i
end
def durable_queue?
!!Chef::Config[:amqp_consumer_id]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment