mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-06-06 23:31:29 +00:00
autopkgtests policy: only load amqplib if needed
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
b5319e33fa
commit
b82f4fc632
@ -26,7 +26,6 @@ import urllib.parse
|
|||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
import apt_pkg
|
import apt_pkg
|
||||||
import amqplib.client_0_8 as amqp
|
|
||||||
|
|
||||||
import britney2.hints
|
import britney2.hints
|
||||||
from britney2.policies.policy import BasePolicy, PolicyVerdict
|
from britney2.policies.policy import BasePolicy, PolicyVerdict
|
||||||
@ -145,6 +144,7 @@ class AutopkgtestPolicy(BasePolicy):
|
|||||||
amqp_url = self.options.adt_amqp
|
amqp_url = self.options.adt_amqp
|
||||||
|
|
||||||
if amqp_url.startswith('amqp://'):
|
if amqp_url.startswith('amqp://'):
|
||||||
|
import amqplib.client_0_8 as amqp
|
||||||
# depending on the setup we connect to a AMQP server
|
# depending on the setup we connect to a AMQP server
|
||||||
creds = urllib.parse.urlsplit(amqp_url, allow_fragments=False)
|
creds = urllib.parse.urlsplit(amqp_url, allow_fragments=False)
|
||||||
self.amqp_con = amqp.Connection(creds.hostname, userid=creds.username,
|
self.amqp_con = amqp.Connection(creds.hostname, userid=creds.username,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user