diff options
| author | Robert Günzler <r@gnzler.io> | 2025-09-07 17:32:13 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2025-09-25 13:17:33 +0200 |
| commit | a063b1a7e1ac3ae49881ff5a51b30b39fb937785 (patch) | |
| tree | a6523475f54f35db22320ca96f640793fb8708bc /bundles/syncthing/items.py | |
| parent | 8abf0af2cb53b5001672039332739e486b26cd00 (diff) | |
syncthing: conditionally run actions
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '')
| -rw-r--r-- | bundles/syncthing/items.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/bundles/syncthing/items.py b/bundles/syncthing/items.py index 75b713c..8d06223 100644 --- a/bundles/syncthing/items.py +++ b/bundles/syncthing/items.py @@ -3,9 +3,9 @@ if node.os != "alpine": svc_openrc = { "syncthing": { - "enabled": True, - "running": True, - "needs": [ + 'enabled': True, + 'running': True, + 'needs': [ "pkg_apk:syncthing-openrc", ], }, @@ -13,19 +13,20 @@ svc_openrc = { files = { "/etc/traefik/syncthing-gui.yaml": { - "content_type": "mako", - "source": "traefik.yaml", - "needs": {"bundle:traefik"}, + 'content_type': "mako", + 'source': "traefik.yaml", + 'needs': {"bundle:traefik"}, }, } actions = { "syncthing_generate_config": { - "command": "test -d /var/lib/syncthing/.local/state/syncthing || syncthing generate --no-default-folder", + 'command': "syncthing generate --no-default-folder", + 'unless': "test -d /var/lib/syncthing/.local/state/syncthing", }, "syncthing_patch_config": { - "command": "patch -sfN -d /var/lib/syncthing -p1", - "data_stdin": """ + 'command': "patch -sfN -d /var/lib/syncthing -p1", + 'data_stdin': """ --- a/.local/state/syncthing/config.xml +++ b/.local/state/syncthing/config.xml @@ -52,7 +52,7 @@ @@ -38,7 +39,8 @@ actions = { <theme>default</theme> </gui> """, - "needs": {"action:syncthing_generate_config"}, - "triggers": {"svc_openrc:syncthing:restart"}, + 'needs': {"action:syncthing_generate_config"}, + 'triggers': {"svc_openrc:syncthing:restart"}, + 'unless': "grep -q '0.0.0.0:8384' /var/lib/syncthing/.local/state/syncthing/config.xml", }, } |