]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add template for sidecar run script
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 17 Nov 2023 20:20:29 +0000 (15:20 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 2 Jan 2024 14:30:21 +0000 (09:30 -0500)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadmlib/templates/sidecar.run.j2 [new file with mode: 0644]
src/cephadm/cephadmlib/templating.py

diff --git a/src/cephadm/cephadmlib/templates/sidecar.run.j2 b/src/cephadm/cephadmlib/templates/sidecar.run.j2
new file mode 100644 (file)
index 0000000..b3e4ecd
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+# {{ comment }}
+
+set -e
+if [ "$1" = stop ] || [ "$1" = poststop ]; then
+    ! {{ sidecar.stop_cmd() | map('shellquote') | join(' ') }}
+    ! {{ ctx.container_engine.path }} inspect {{ sidecar.cname | shellquote }} &>/dev/null
+    exit $?
+fi
+
+! {{ sidecar.rm_cmd() | map('shellquote') | join(' ') }} 2> /dev/null
+{%- if has_podman_engine %}
+! {{ sidecar.rm_cmd(storage=True) | map('shellquote') | join(' ') }} 2> /dev/null
+{%- endif %}
+
+exec {{ sidecar.run_cmd() | map('shellquote') | join(' ') }}
+
index 2f944fd328f83ef8ff320dd3b67d038f784fceaa..4604d8c14c747c79a3c090152eb4a21071a0ebe3 100644 (file)
@@ -27,6 +27,7 @@ class Templates(str, enum.Enum):
     sidecar_service = 'sidecar.service.j2'
     cluster_logrotate_config = 'cluster.logrotate.config.j2'
     cephadm_logrotate_config = 'cephadm.logrotate.config.j2'
+    sidecar_run = 'sidecar.run.j2'
 
     def __str__(self) -> str:
         return self.value