canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #06109
[Merge] ~hyask/autopkgtest-cloud:skia/worker_debug into autopkgtest-cloud:master
Skia has proposed merging ~hyask/autopkgtest-cloud:skia/worker_debug into autopkgtest-cloud:master.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~hyask/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/480511
Easier debugging option.
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~hyask/autopkgtest-cloud:skia/worker_debug 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 7dfe81b..0b2739b 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -59,6 +59,7 @@ except KeyError:
my_path = os.path.dirname(__file__)
root_path = os.path.dirname(os.path.abspath(my_path))
+debug = False
args = None
cfg = None
swift_creds = {}
@@ -1060,7 +1061,8 @@ def request(msg):
testargs = [pkgname]
argv += testargs
- if args.debug:
+ global debug
+ if debug:
argv.append("--debug")
timeout_short = 300
@@ -1618,7 +1620,7 @@ def amqp_connect(cfg, callback):
def main():
"""Main program"""
- global cfg, args, swift_creds, swift_upload
+ global cfg, args, swift_creds, swift_upload, debug
args = parse_args()
@@ -1634,20 +1636,32 @@ def main():
"package_size_default": "",
"package_size_big": "",
"extra_args": "",
+ "debug": "",
},
allow_no_value=True,
)
with open(args.config, "r") as f:
cfg.read_file(f)
+ if args.debug or cfg.get("autopkgtest", "debug").lower() in [
+ "1",
+ "true",
+ "yes",
+ ]:
+ debug = True
+
handlers = None
if "INVOCATION_ID" in os.environ:
handlers = [systemd_logging_handler]
logging.basicConfig(
- level=(args.debug and logging.DEBUG or logging.INFO),
+ level=(debug and logging.DEBUG or logging.INFO),
format="%(levelname)s: %(message)s",
handlers=handlers,
)
+ if debug:
+ logging.info("Debug enabled")
+ else:
+ logging.info("Debug disabled")
try:
auth_version = os.environ["SWIFT_AUTH_VERSION"]
diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker.conf b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker.conf
index 16f8a80..d9664c4 100644
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker.conf
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker.conf
@@ -22,6 +22,9 @@ per_package_config_dir = ../../../../../../autopkgtest-package-configs/
# Time between retries when a test fails (default in the code is 300s, let's make it 5s for dev)
retry_delay = 5
+# Enable autopkgtest '--debug' flag, along with more verbose worker
+debug = 0
+
[virt]
# normal packages get $PACKAGESIZE set to this value
package_size_default = m1.small
diff --git a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
index 0847f8a..cd81d53 100644
--- a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
+++ b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
@@ -600,6 +600,7 @@ def write_worker_config():
config().get("stable-release-percentage")
),
"retry_delay": "300",
+ "debug": "0",
},
"virt": {
"args": config().get("worker-args"),