From 31689a134ec7d0b9cf21d94b6fd13d0f0acfed50 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Fri, 17 Nov 2023 15:20:29 -0500 Subject: [PATCH] cephadm: add template for sidecar run script Signed-off-by: John Mulligan --- src/cephadm/cephadmlib/templates/sidecar.run.j2 | 17 +++++++++++++++++ src/cephadm/cephadmlib/templating.py | 1 + 2 files changed, 18 insertions(+) create mode 100644 src/cephadm/cephadmlib/templates/sidecar.run.j2 diff --git a/src/cephadm/cephadmlib/templates/sidecar.run.j2 b/src/cephadm/cephadmlib/templates/sidecar.run.j2 new file mode 100644 index 0000000000000..b3e4ecdaba3bc --- /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 2f944fd328f83..4604d8c14c747 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 -- 2.39.5