Skip to content

Bug: AUTOSSH_SERVICE_DEFAULTS After= line malformed due to missing commas in list #6

Description

@pbitzer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions