puppet-tripleo/files/certmonger-metrics-qdr-refresh.sh
Cédric Jeanneret 86eab6ce8c Corrected default value for container_cli
Since Stein (OSP-15), we're using podman by default. We therefore must
reflect this in certmonger refresh secripts.

Change-Id: I377511aa0be7efbf58cd2a70e8b9a774bb679f61
2019-11-28 09:12:51 +01:00

25 lines
990 B
Bash

#!/bin/bash
container_cli=$(hiera -c /etc/puppet/hiera.yaml container_cli podman)
container_name=$($container_cli ps --format="{{.Names}}" | grep metrics_qdr)
service_certificate="$(hiera -c /etc/puppet/hiera.yaml tripleo::metrics::qdr::service_certificate)"
service_key="$(hiera -c /etc/puppet/hiera.yaml tripleo::metrics::qdr::service_key)"
# Copy the new cert from the mount-point to the real path
$container_cli exec "$container_name" cp "/var/lib/kolla/config_files/src-tls$service_certificate" "$service_certificate"
# Copy the new key from the mount-point to the real path
$container_cli exec "$container_name" cp "/var/lib/kolla/config_files/src-tls$service_key" "$service_key"
# Set appropriate permissions
$container_cli exec "$container_name" chown qdrouterd:qdrouterd "$service_certificate"
$container_cli exec "$container_name" chown qdrouterd:qdrouterd "$service_key"
# Trigger a container restart to read the new certificates
$container_cli restart $container_name