← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:cloud-charm-fixes into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:cloud-charm-fixes 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/473299

Fixes to the cloud charm to ease redeployability of units
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:cloud-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 68c7768..e01a689 100644
--- a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
+++ b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
@@ -235,8 +235,10 @@ def stop():
 
 @when_all("autopkgtest.target-restart-needed", "autopkgtest.target_running")
 def restart_target():
-    status.maintenance("Restarting autopkgtest systemd target")
-    subprocess.check_call(["systemctl", "restart", "autopkgtest.target"])
+    status.maintenance("Restarting autopkgtest systemd target with --no-block")
+    subprocess.check_call(
+        ["systemctl", "restart", "autopkgtest.target", "--no-block"]
+    )
     status.maintenance("Done restarting autopkgtest systemd target")
     clear_flag("autopkgtest.target-restart-needed")
 
@@ -332,11 +334,13 @@ def clear_rabbitmq():
     status.maintenance("Done clearing rabbitmq configuration")
 
 
-@when("config.changed.nova-rcs")
+@when_any(
+    "config.set.nova-rcs",
+    "autopkgtest.no-nova-rcs",
+)
 def update_nova_rcs():
     status.maintenance("Updating nova rc files")
     # pylint: disable=import-outside-toplevel
-    import base64
     from io import BytesIO
     from tarfile import TarFile
 
@@ -350,13 +354,14 @@ def update_nova_rcs():
 
     clear_old_rcs()
 
-    bytes_file = BytesIO(base64.b64decode(rctar))
+    bytes_file = BytesIO(bytes(rctar, encoding="utf-8"))
     tar = TarFile(fileobj=bytes_file)
 
     log("...got {}".format(", ".join(tar.getnames())), "INFO")
 
     tar.extractall(os.path.expanduser("~ubuntu/cloudrcs/"))
     status.maintenance("Done updating nova rc files")
+    clear_flag("autopkgtest.no-nova-rcs")
 
 
 @when("config.default.nova-rcs")
@@ -365,6 +370,8 @@ def clear_old_rcs():
     rcfiles = glob.glob(os.path.expanduser("~ubuntu/cloudrcs/*.rc"))
 
     if not rcfiles:
+        set_flag("autopkgtest.no-nova-rcs")
+        status.maintenance("No old nova rc files to clear")
         return
 
     log("Deleting old cloud .rc files...", "INFO")
@@ -374,7 +381,7 @@ def clear_old_rcs():
         os.unlink(rcfile)
 
     log("...done", "INFO")
-    status.maintenance("Done cleaning old nova rc files")
+    status.active("Done cleaning old nova rc files")
 
 
 @when_all(
@@ -413,9 +420,11 @@ def remove_old_lxd_units():
     "config.set.releases",
 )
 @when_any(
+    "config.set.n-workers",
     "config.changed.n-workers",
     "config.set.lxd-remotes",
     "config.changed.lxd-remotes",
+    "config.set.releases",
     "config.changed.releases",
 )
 def enable_disable_units():
@@ -547,8 +556,20 @@ def write_swift_config():
     "config.changed.worker-net-names",
     "config.changed.worker-upstream-percentage",
     "config.changed.stable-release-percentage",
+    "config.set.worker-flavor-config",
+    "config.set.worker-args",
+    "config.set.worker-setup-command",
+    "config.set.worker-setup-command2",
+    "config.set.releases",
+    "config.set.n-workers",
+    "config.set.lxd-remotes",
+    "config.set.mirror",
+    "config.set.worker-net-names",
+    "config.set.worker-upstream-percentage",
+    "config.set.stable-release-percentage",
+    "config.set.nova-rcs",
+    "config.set.lxd-remotes",
 )
-@when_any("config.set.nova-rcs", "config.set.lxd-remotes")
 def write_worker_config():
     status.maintenance("Writing worker configuration")
 
@@ -794,5 +815,5 @@ def unset_influx_creds():
         os.unlink(os.path.expanduser("~ubuntu/influx.cred"))
     except FileNotFoundError:
         pass
-    status.maintenance("Done deleting influxdb credentials")
+    status.active("Done deleting influxdb credentials")
     clear_flag("autopkgtest.influx-creds-written")
diff --git a/mojo/service-bundle b/mojo/service-bundle
index 4170fe9..143df3a 100644
--- a/mojo/service-bundle
+++ b/mojo/service-bundle
@@ -294,8 +294,8 @@ applications:
                 - service_name: results_reverse_proxy
                   service_options:
                       - server swift {{ storage_host_internal }} ssl verify required ca-file /etc/ssl/certs/ca-certificates.crt
-                      - reqirep  ^(GET|POST|HEAD)\ /results/(.*)     \1\ {{ storage_path_internal }}/\2
-                      - rspirep ^Location:\ (http|https)://{{ storage_host_internal }}{{ storage_path_internal }}\/(.*)   Location:\ \1://{{ hostname }}/results/\2
+                      - http-request replace-pathq  ^(GET|POST|HEAD)\ /results/(.*)     \1\ {{ storage_path_internal }}/\2
+                      - http-response replace-header ^Location:\ (http|https)://{{ storage_host_internal }}{{ storage_path_internal }}\/(.*)   Location:\ \1://{{ hostname }}/results/\2
             ssl_cert: DEFAULT
             ssl_key:
 {%- elif stage_name == "devel" %}