From: John Mulligan Date: Fri, 17 Nov 2023 20:20:29 +0000 (-0500) Subject: cephadm: add template for sidecar run script X-Git-Tag: testing/wip-batrick-testing-20240411.154038~702^2~22 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=31689a134ec7d0b9cf21d94b6fd13d0f0acfed50;p=ceph-ci.git cephadm: add template for sidecar run script Signed-off-by: John Mulligan --- diff --git a/src/cephadm/cephadmlib/templates/sidecar.run.j2 b/src/cephadm/cephadmlib/templates/sidecar.run.j2 new file mode 100644 index 00000000000..b3e4ecdaba3 --- /dev/null +++ b/src/cephadm/cephadmlib/templates/sidecar.run.j2 @@ -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(' ') }} + diff --git a/src/cephadm/cephadmlib/templating.py b/src/cephadm/cephadmlib/templating.py index 2f944fd328f..4604d8c14c7 100644 --- a/src/cephadm/cephadmlib/templating.py +++ b/src/cephadm/cephadmlib/templating.py @@ -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