fix(dispatcher): add missing files for local dispatcher
[arvados-formula.git] / arvados / dispatcher / service / file.sls
diff --git a/arvados/dispatcher/service/file.sls b/arvados/dispatcher/service/file.sls
new file mode 100644 (file)
index 0000000..df75286
--- /dev/null
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+# vim: ft=sls
+
+{#- Get the `tplroot` from `tpldir` #}
+{%- set tplroot = tpldir.split('/')[0] %}
+{%- set sls_config_file = tplroot ~ '.config.file' %}
+{%- from tplroot ~ "/map.jinja" import arvados with context %}
+{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
+
+include:
+  - ..package
+  - {{ sls_config_file }}
+  - .running
+
+{%- if arvados.dispatcher.pkg.name == 'crunch-dispatch-local' %}
+arvados-dispatcher-service-file-file-managed-crunch-run-sh:
+  file.managed:
+    - name: /usr/local/bin/crunch-run.sh
+    - source: {{ files_switch(['crunch-run-sh.tmpl'],
+                              lookup='arvados-dispatcher-service-file-file-managed-crunch-run-sh',
+                              use_subpath=True
+                 )
+              }}
+    - mode: '0755'
+    - user: root
+    - group: root
+    - makedirs: True
+    - template: jinja
+    - context:
+        arvados: {{ arvados | json }}
+    - require:
+      - pkg: arvados-dispatcher-package-install-pkg-installed
+
+arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service:
+  file.managed:
+    - name: /etc/systemd/system/crunch-dispatch-local.service
+    - source: {{ files_switch(['crunch-dispatch-local-service.tmpl'],
+                              lookup='arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service',
+                              use_subpath=True
+                 )
+              }}
+    - mode: '0644'
+    - user: root
+    - group: root
+    - makedirs: True
+    - template: jinja
+    - context:
+        arvados: {{ arvados | json }}
+    - require:
+      - file: arvados-dispatcher-service-file-file-managed-crunch-run-sh
+      - pkg: arvados-dispatcher-package-install-pkg-installed
+  cmd.run:
+    - name: systemctl daemon-reload
+    - require_in:
+      - service: arvados-dispatcher-service-running-service-running
+    - require:
+      - file: arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service
+{%- endif %}