Browse Source

nova_virtlogd_wrapper: Simplify string matching

Currently the nova_virtlogd_wrapper script has some lower/upper case
patterns to match strings to identify container status, but this
requires redundant but careful definitions.

This change "lowercase"s status string so that we can define status
more simply.

Change-Id: Ia3f9679b7a43d3ab7315b5d87b31c87ba9c14109
changes/65/801865/1
Takashi Kajinami 2 months ago
parent
commit
35dbf4e6c2
  1. 6
      templates/nova/virtlogd.epp

6
templates/nova/virtlogd.epp

@ -12,13 +12,13 @@ VIRTLOGD_CONTAINER=$(${CLI} ps -a --filter name="^${NAME}$" --format '{{.ID}}:{{
CONTAINER_ID=$(echo $VIRTLOGD_CONTAINER | awk -F: '{print $1}')
CONTAINER_STATUS=$(echo $VIRTLOGD_CONTAINER | awk -F: '{print $2}')
CONTAINER_STATUS_SHORT=$(echo $CONTAINER_STATUS | awk '{print $1}')
CONTAINER_STATUS_SHORT=$(echo $CONTAINER_STATUS | awk '{print $1}' | tr '[A-Z]' '[a-z]' )
case ${CONTAINER_STATUS_SHORT} in
Up | up | UP)
up)
echo "Container ${NAME} with id ${CONTAINER_ID} is already running!"
;;
Exited| exited| EXITED| Created| created| CREATED)
exited| created)
echo "Removing orphaned ${NAME} container ${CONTAINER_ID}"
$CLI stop ${CONTAINER_ID} || true
$CLI rm -f ${CONTAINER_ID} || true

Loading…
Cancel
Save