about summary refs log tree commit diff
path: root/bundles/syncthing/items.py
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/syncthing/items.py')
-rw-r--r--bundles/syncthing/items.py24
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",
     },
 }