From 385b92e2df5db6c4e67b89ad142b650b6c224990 Mon Sep 17 00:00:00 2001 From: Jon Spriggs Date: Sun, 27 Apr 2025 21:44:13 +0100 Subject: [PATCH 1/2] Add path definitions and error checking to allow deployment of the dev server to defined paths --- dev-setup | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/dev-setup b/dev-setup index bc29b2b860..3e93acabf6 100755 --- a/dev-setup +++ b/dev-setup @@ -7,9 +7,24 @@ set -e # REPL. That said, it doesn't seem like a great ROI to sort it out right now # because it will probably require introducing a new setting for the vendored gem # dir into puppetserver.conf. -ROOTDIR="${HOME}/.puppetlabs" -CONFDIR="${ROOTDIR}/etc/puppet" -CODEDIR="${ROOTDIR}/etc/code" +if [ -z "${ROOTDIR:-}" ] +then + ROOTDIR="${HOME}/.puppetlabs" +fi +if [ -z "${CONFDIR:-}" ] +then + CONFDIR="${ROOTDIR}/etc/puppet" +fi +if [ -z "${CODEDIR:-}" ] +then + CODEDIR="${ROOTDIR}/etc/code" +fi + +if ! [ -e "${CONFDIR}/puppet.conf" ] && [ -z "${FORCE:-}" ] +then + echo "ERROR: ${CONFDIR}/puppet.conf already exists. Please run with FORCE=1 to overwrite" >&2 + exit 1 +fi gem_list=() while read LINE From e17342d442961189b33275540e8c867cb6ff861f Mon Sep 17 00:00:00 2001 From: Jon Spriggs Date: Sun, 27 Apr 2025 21:47:42 +0100 Subject: [PATCH 2/2] Remove TODO comments --- dev-setup | 9 --------- 1 file changed, 9 deletions(-) diff --git a/dev-setup b/dev-setup index 3e93acabf6..1ae1b5161e 100755 --- a/dev-setup +++ b/dev-setup @@ -2,11 +2,6 @@ set -e -# TODO: Ultimately it'd be nice to not hard-code these paths, because it is -# not guaranteed to match up with the paths in puppetserver.conf or used by the -# REPL. That said, it doesn't seem like a great ROI to sort it out right now -# because it will probably require introducing a new setting for the vendored gem -# dir into puppetserver.conf. if [ -z "${ROOTDIR:-}" ] then ROOTDIR="${HOME}/.puppetlabs" @@ -46,10 +41,6 @@ lein gem install --no-document "${gem_list[@]}" echo "Setting up puppet.conf for dev environment" -# TODO: current implementation will simply overwrite puppet.conf. Might be better -# to add some checks at the beginning of this script, and abort the whole script -# if it already exists. - if [ -z "${MASTERHOST}" ]; then echo " No value specified for environment variable 'MASTERHOST'; using 'localhost' for puppet certname." CERTNAME="localhost"