← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~hyask/autopkgtest-cloud:skia/worker_charm_fixes into autopkgtest-cloud:master

 

Skia has proposed merging ~hyask/autopkgtest-cloud:skia/worker_charm_fixes 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/469418

Two changes to the worker reactive charm after it failed to `mojo run`.
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~hyask/autopkgtest-cloud:skia/worker_charm_fixes into autopkgtest-cloud:master.
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 4e73fd2..f2a8ab7 100644
--- a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
+++ b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
@@ -539,14 +539,14 @@ def write_worker_config():
         "autopkgtest": {
             "checkout_dir": AUTOPKGTEST_LOCATION,
             "releases": config().get("releases"),
-            "setup_command": config().get("worker-setup-command"),
-            "setup_command2": config().get("worker-setup-command2"),
+            "setup_command": config().get("worker-setup-command") or "",
+            "setup_command2": config().get("worker-setup-command2") or "",
             "per_package_config_dir": AUTOPKGTEST_PER_PACKAGE_LOCATION,
-            "worker_upstream_percentage": config().get(
-                "worker-upstream-percentage"
+            "worker_upstream_percentage": str(
+                config().get("worker-upstream-percentage")
             ),
-            "stable_release_percentage": config().get(
-                "stable-release-percentage"
+            "stable_release_percentage": str(
+                config().get("stable-release-percentage")
             ),
         },
         "virt": {
@@ -572,10 +572,10 @@ def write_worker_config():
 
         return s
 
-    def write(conf_file):
+    def write(conf_file, conf):
         with open(conf_file, "w") as cf:
             cp = configparser.ConfigParser()
-            cp.read_dict(region_arch_conf)
+            cp.read_dict(conf)
             cp.write(cf)
 
         # FIXME: Hotfix for bos01
@@ -624,14 +624,14 @@ def write_worker_config():
                     "worker-{}-{}.conf".format(region, arch),
                 )
                 region_arch_conf["autopkgtest"]["architectures"] = arch
-            write(conf_file)
+            write(conf_file, region_arch_conf)
 
     for arch in lxdremotes_yaml:
         conf_file = os.path.join(
             os.path.expanduser("~ubuntu"), "worker-lxd-{}.conf".format(arch)
         )
         conf["autopkgtest"]["architectures"] = arch
-        write(conf_file)
+        write(conf_file, conf)
 
     status.maintenance("Done writing worker configuration")
     set_flag("autopkgtest.daemon-reload-needed")