canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #04850
[Merge] ~andersson123/autopkgtest-cloud:fix-osc-lib-traceback into autopkgtest-cloud:master
Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:fix-osc-lib-traceback into autopkgtest-cloud:master.
Commit message:
Commit #1:
feat: cloud: add python3-osc-lib to layer.yaml
Whilst I believe this dependency comes pre-installed in our
infrastructure, since the worker code depends directly on this (in the
call to `wait_for_delete`, in the `kill_openstack_server` function), it
can't hurt to explicity declare it in the layer.yaml.
Commit #2:
fix: worker: import osc_lib in a different manner
The previous method of importing osc_lib was resulting in the following
traceback:
```
AttributeError: module 'osc_lib' has no attribute 'utils'
```
I tried importing osc_lib.utils in many different ways - both in a venv
on my dev machine and on the servers in prod. The implementation in this
commit is the one that worked both in a venv on my machine, and in a
python shell in production, as well as in the worker code after a
cowboy.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/469861
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:fix-osc-lib-traceback into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
index 82839f8..2a55bce 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -31,13 +31,13 @@ import amqplib.client_0_8 as amqp
import distro_info
import novaclient.client
import novaclient.exceptions
-import osc_lib
import swiftclient
import systemd.journal
from influxdb import InfluxDBClient
from influxdb.exceptions import InfluxDBClientError
from keystoneauth1 import session
from keystoneauth1.identity import v2, v3
+from osc_lib import utils as osc_utils
ALL_RELEASES = distro_info.UbuntuDistroInfo().get_all(result="object")
@@ -672,7 +672,7 @@ def kill_openstack_server(test_uuid: str):
if test_uuid in instance.name:
try:
instance.delete()
- if not osc_lib.utils.wait_for_delete(
+ if not osc_utils.wait_for_delete(
nova.servers,
instance.id,
):
diff --git a/charms/focal/autopkgtest-cloud-worker/layer.yaml b/charms/focal/autopkgtest-cloud-worker/layer.yaml
index a150607..d8f8c0a 100644
--- a/charms/focal/autopkgtest-cloud-worker/layer.yaml
+++ b/charms/focal/autopkgtest-cloud-worker/layer.yaml
@@ -32,4 +32,5 @@ options:
- vim
- qemu-user-static
- binfmt-support
+ - python3-osc-lib
include_system_packages: true