From d5181ef32a171578035ef72e1a293d03e17567f0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 3 Jul 2015 07:35:00 +0200 Subject: [PATCH] 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. --- autopkgtest.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/autopkgtest.py b/autopkgtest.py index 1c8acff..4ed789f 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -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: