canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #03292
[Merge] ~andersson123/autopkgtest-cloud:amend-inserts-paramstyle-named into autopkgtest-cloud:master
Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:amend-inserts-paramstyle-named into autopkgtest-cloud:master.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/462137
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:amend-inserts-paramstyle-named 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 9ff2ff1..f1bbac5 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -360,8 +360,11 @@ def process_output_dir(
files.add("testinfo.json")
d = {}
- with open(os.path.join(dir, "testinfo.json"), "r") as testinfo:
- d = json.load(testinfo)
+ # we have to first check this file exists - when a package is marked with
+ # dont_run for whatever reason, the file doesn't exist
+ if os.path.isfile(os.path.join(dir, "testinfo.json")):
+ with open(os.path.join(dir, "testinfo.json"), "r") as testinfo:
+ d = json.load(testinfo)
d["uuid"] = test_uuid
for key in KEYS_FOR_ADDITIONAL_PARAMS:
d[key] = additional_params.get(key)
diff --git a/charms/focal/autopkgtest-web/webcontrol/helpers/utils.py b/charms/focal/autopkgtest-web/webcontrol/helpers/utils.py
index cf9ca27..0e12e26 100644
--- a/charms/focal/autopkgtest-web/webcontrol/helpers/utils.py
+++ b/charms/focal/autopkgtest-web/webcontrol/helpers/utils.py
@@ -6,6 +6,8 @@ import logging
import os
import random
import sqlite3
+
+sqlite3.paramstyle = "named"
import time
import distro_info
@@ -117,9 +119,18 @@ def get_test_id(db_con, release, arch, src):
c = db_con.cursor()
while True:
try:
+ insert_me = {
+ "id": None,
+ "release": release,
+ "arch": arch,
+ "package": src,
+ }
c.execute(
- "INSERT INTO test VALUES (NULL, ?, ?, ?)",
- (release, arch, src),
+ (
+ "INSERT INTO test(id, release, arch, package) "
+ "VALUES (:id, :release, :arch, :package)"
+ ),
+ insert_me,
)
except sqlite3.IntegrityError:
# our cache got out of date in the meantime
diff --git a/charms/focal/autopkgtest-web/webcontrol/publish-db b/charms/focal/autopkgtest-web/webcontrol/publish-db
index 76883bd..b442469 100755
--- a/charms/focal/autopkgtest-web/webcontrol/publish-db
+++ b/charms/focal/autopkgtest-web/webcontrol/publish-db
@@ -8,6 +8,7 @@ import gzip
import logging
import os
import sqlite3
+sqlite3.paramstyle = "named"
import tempfile
import urllib.request
Follow ups