autopkgtest AMQP: Don't declare queues

Don't use kombu's SimpleQueue() as that always declares queues and we neither
want that (we want to know when we try to talk to a nonexisting queue), nor
might the RabbitMQ ACL allow us to do that. So use kombu.Producer without queue
declaration.
bzr-import-20160707
Martin Pitt 10 years ago
parent 335073e901
commit d5181ef32a

@ -350,10 +350,11 @@ class AutoPackageTest(object):
if amqp_url.startswith('amqp://'):
with kombu.Connection(amqp_url) as conn:
for q in queues:
amqp_queue = conn.SimpleQueue(q)
for pkg in self.requested_tests:
amqp_queue.put(pkg)
amqp_queue.close()
# don't use SimpleQueue here as it always declares queues;
# ACLs might not allow that
with kombu.Producer(conn, routing_key=q, auto_declare=False) as p:
for pkg in self.requested_tests:
p.publish(pkg)
elif amqp_url.startswith('file://'):
# in testing mode, adt_amqp will be a file:// URL
with open(amqp_url[7:], 'a') as f:

Loading…
Cancel
Save