Summary
In src/brokkr/utils/services.py, AUTOSSH_SERVICE_DEFAULTS builds the After= value with " ".join([...]) but is missing commas between the first two list entries. Python's implicit string literal concatenation silently merges them into a single malformed token.
Buggy code
AUTOSSH_SERVICE_DEFAULTS = {
"Unit": {
...
"After": " ".join([
"multi-user.target" # <-- missing comma
"network.target" # <-- missing comma
"sshd.service",
]),
Effect
Python evaluates the first two entries as a single string: "multi-user.targetnetwork.targetsshd.service". The resulting service unit contains:
After = multi-user.targetnetwork.targetsshd.service
systemd silently ignores this malformed token, so the autossh service has no effective After= ordering constraint. This means autossh can start before the network is available on boot, causing transient tunnel failures on startup.
Fix
Add the missing commas:
"After": " ".join([
"multi-user.target",
"network.target",
"sshd.service",
]),
Notes
- The
BROKKR_SERVICE_DEFAULTS After= list does not have this bug.
- The
BROKKR_SERVICE_DEFAULTS Wants= list has a minor related style issue: "systemd-timesyncd.service sshd.service" is a single string entry containing two space-separated values rather than two separate list items, but since " ".join() still produces a valid result the functional impact is cosmetic only.
- Discovered while investigating service ordering on a HAMMA fleet sensor after reinstall.
Summary
In
src/brokkr/utils/services.py,AUTOSSH_SERVICE_DEFAULTSbuilds theAfter=value with" ".join([...])but is missing commas between the first two list entries. Python's implicit string literal concatenation silently merges them into a single malformed token.Buggy code
Effect
Python evaluates the first two entries as a single string:
"multi-user.targetnetwork.targetsshd.service". The resulting service unit contains:systemd silently ignores this malformed token, so the autossh service has no effective
After=ordering constraint. This means autossh can start before the network is available on boot, causing transient tunnel failures on startup.Fix
Add the missing commas:
Notes
BROKKR_SERVICE_DEFAULTSAfter=list does not have this bug.BROKKR_SERVICE_DEFAULTSWants=list has a minor related style issue:"systemd-timesyncd.service sshd.service"is a single string entry containing two space-separated values rather than two separate list items, but since" ".join()still produces a valid result the functional impact is cosmetic only.