From 2022a7d315447ed070bc85d5cf83201e7cfdd180 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Thu, 14 Dec 2023 10:41:09 +0100 Subject: [PATCH] Make setting for admin-api idempotent if restarting the server, the shell snippets will run again a duplicate admin-api entry causes the puppetserver to not start --- .../docker-entrypoint.d/88-enable-cache-delete-api.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/puppetserver/docker-entrypoint.d/88-enable-cache-delete-api.sh b/puppetserver/docker-entrypoint.d/88-enable-cache-delete-api.sh index 12e2a9ea..4dad2a35 100644 --- a/puppetserver/docker-entrypoint.d/88-enable-cache-delete-api.sh +++ b/puppetserver/docker-entrypoint.d/88-enable-cache-delete-api.sh @@ -1,5 +1,9 @@ #!/bin/bash # if [[ "$PUPPETSERVER_ENABLE_ENV_CACHE_DEL_API" == true ]]; then - /opt/puppetlabs/puppet/bin/ruby /add_cache_del_api_auth_rules.rb + if [ $(grep 'puppet-admin-api' /etc/puppetlabs/puppetserver/conf.d/auth.conf) ]; then + echo "Admin API already set" + else + /opt/puppetlabs/puppet/bin/ruby /add_cache_del_api_auth_rules.rb + fi fi