forked from puppetlabs/puppetserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev-setup
executable file
·54 lines (42 loc) · 1.78 KB
/
dev-setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
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"
VENDORED_GEMS_HOME="${ROOTDIR}/opt/server/data/puppetserver/vendored-jruby-gems"
gem_list=()
while read LINE
do
gem_name=$(echo $LINE |awk '{print $1}')
gem_version=$(echo $LINE |awk '{print $2}')
gem_list+=("$gem_name:$gem_version")
done < ./resources/ext/build-scripts/jruby-gem-list.txt
echo "Installing vendored gems to '${VENDORED_GEMS_HOME}'"
lein gem install --install-dir "${VENDORED_GEMS_HOME}" --no-document "${gem_list[@]}"
./dev/install-test-gems.sh
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"
else
echo " Found environment variable 'MASTERHOST'; using value '${MASTERHOST}' for puppet certname."
CERTNAME="${MASTERHOST}"
fi
mkdir -p "${CONFDIR}"
cat > "${CONFDIR}/puppet.conf" <<PUPPET_CONF_CONTENT
[main]
certname = ${CERTNAME}
[agent]
server = ${CERTNAME}
PUPPET_CONF_CONTENT
echo "Creating modules directory for production environment, to avoid misleading pluginsync warning messages."
mkdir -p "${CODEDIR}/environments/production/modules"
echo "DONE!"