Merge autopkgtest-cloud:dont-fail-on-reset into autopkgtest-cloud:master

Proposed by Brian Murray
Status: Merged
Merged at revision: 4cae868cdd2cf58668a0b78f1fe640fd57768d60
Proposed branch: autopkgtest-cloud:dont-fail-on-reset
Merge into: autopkgtest-cloud:master
Diff against target: 36 lines (+14/-11)
1 file modified
charms/focal/autopkgtest-cloud-worker/lib/systemd.py (+14/-11)
Reviewer Review Type Date Requested Status
Paride Legovini (community) Approve
Ubuntu Release Team Pending
Review via email: mp+427982@code.launchpad.net

Description of the change

When adding a new lxd-armhf runner I encountered the following error:

2022-08-05 17:02:14 DEBUG unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 calling DisableUnitFiles then StopUnit on ['<email address hidden>']
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 Traceback (most recent call last):
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 File "/var/lib/juju/agents/unit-autopkgtest-lxd-worker-0/charm/hooks/config-changed", line 22, in <module>
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 main()
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 File "/var/lib/juju/agents/unit-autopkgtest-lxd-worker-0/.venv/lib/python3.8/site-packages/charms/reactive/__init__.py", line 74, in main
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 bus.dispatch(restricted=restricted_mode)
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 File "/var/lib/juju/agents/unit-autopkgtest-lxd-worker-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 390, in dispatch
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 _invoke(other_handlers)
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 File "/var/lib/juju/agents/unit-autopkgtest-lxd-worker-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 359, in _invoke
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 handler.invoke()
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 File "/var/lib/juju/agents/unit-autopkgtest-lxd-worker-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 181, in invoke
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 self._action(*args)
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 File "/var/lib/juju/agents/unit-autopkgtest-lxd-worker-0/charm/reactive/autopkgtest_cloud_worker.py", line 316, in enable_disable_units
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 set_up_systemd_units(
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 File "/var/lib/juju/agents/unit-autopkgtest-lxd-worker-0/charm/lib/systemd.py", line 370, in set_up_systemd_units
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 disable(unit_names)
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 File "/var/lib/juju/agents/unit-autopkgtest-lxd-worker-0/charm/lib/systemd.py", line 90, in disable
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 SYSTEM_BUS.call_sync(
2022-08-05 17:02:15 WARNING unit.autopkgtest-lxd-worker/0.config-changed logger.go:60 gi.repository.GLib.Error: g-io-error-quark: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit <email address hidden> not loaded. (36)

If the unit isn't loaded I don't think this needs to stop the charm from running but I'm not entirely certain how reactive charms work so ICBW.

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

I cowboy'ed this change on the autopkgtest-lxd-worker without any issues.

Revision history for this message
Paride Legovini (paride) wrote :

This LGTM, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/charms/focal/autopkgtest-cloud-worker/lib/systemd.py b/charms/focal/autopkgtest-cloud-worker/lib/systemd.py
index 8c9856e..8eed044 100644
--- a/charms/focal/autopkgtest-cloud-worker/lib/systemd.py
+++ b/charms/focal/autopkgtest-cloud-worker/lib/systemd.py
@@ -87,17 +87,20 @@ def disable(unit_names):
87 "StopUnit",87 "StopUnit",
88 )88 )
89 for unit in unit_names:89 for unit in unit_names:
90 SYSTEM_BUS.call_sync(90 try:
91 "org.freedesktop.systemd1",91 SYSTEM_BUS.call_sync(
92 "/org/freedesktop/systemd1",92 "org.freedesktop.systemd1",
93 "org.freedesktop.systemd1.Manager",93 "/org/freedesktop/systemd1",
94 "ResetFailedUnit",94 "org.freedesktop.systemd1.Manager",
95 GLib.Variant("(s)", (unit,)),95 "ResetFailedUnit",
96 None, # reply type96 GLib.Variant("(s)", (unit,)),
97 Gio.DBusCallFlags.NONE,97 None, # reply type
98 -1.0, # timeout98 Gio.DBusCallFlags.NONE,
99 None,99 -1.0, # timeout
100 ) # cancellable100 None,
101 ) # cancellable
102 except GLib.Error:
103 pass
101 try:104 try:
102 dropindir = os.path.join(105 dropindir = os.path.join(
103 os.path.sep, "etc", "systemd", "system", "{}.d".format(unit)106 os.path.sep, "etc", "systemd", "system", "{}.d".format(unit)

Subscribers

People subscribed via source and target branches