Skip to content

Add path definitions and error checking to allow deployment of the dev server to defined paths #2905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions dev-setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@

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.
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
Expand All @@ -31,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"
Expand Down