From 181377cf7664ec44658c657e0b134512e7c1e8ba Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Thu, 18 Apr 2024 16:10:21 +0200 Subject: [PATCH] update csr_attributes --- puppetserver/docker-entrypoint.d/89-csr_attributes.rb | 5 ++--- puppetserver/docker-entrypoint.d/89-csr_attributes.sh | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/puppetserver/docker-entrypoint.d/89-csr_attributes.rb b/puppetserver/docker-entrypoint.d/89-csr_attributes.rb index 1a5419d2..3109f31e 100755 --- a/puppetserver/docker-entrypoint.d/89-csr_attributes.rb +++ b/puppetserver/docker-entrypoint.d/89-csr_attributes.rb @@ -5,11 +5,10 @@ begin csr_yaml = YAML.dump(JSON.load(ENV['CSR_ATTRIBUTES'])) - File.open('/etc/puppetlabs/puppet/csr_attributes.yaml', 'w') do |file| - file.write(csr_yaml) - end + File.write('/etc/puppetlabs/puppet/csr_attributes.yaml', csr_yaml) rescue => error puts "Error on reading JSON env. Terminating" + puts "Malformed JSON: #{ENV['CSR_ATTRIBUTES']}" p error.message exit 99 end diff --git a/puppetserver/docker-entrypoint.d/89-csr_attributes.sh b/puppetserver/docker-entrypoint.d/89-csr_attributes.sh index e8a38f94..4ed87146 100755 --- a/puppetserver/docker-entrypoint.d/89-csr_attributes.sh +++ b/puppetserver/docker-entrypoint.d/89-csr_attributes.sh @@ -2,5 +2,5 @@ set -e -echo $CSR_ATTRIBUTES +echo "CSR Attributes: ${CSR_ATTRIBUTES}" /opt/puppetlabs/puppet/bin/ruby /docker-entrypoint.d/89-csr_attributes.rb