diff options
Diffstat (limited to 'modules/base_installation/files')
3 files changed, 26 insertions, 3 deletions
diff --git a/modules/base_installation/files/cronie/puppet-post-merge b/modules/base_installation/files/cronie/puppet-post-merge index ac5e3ff..f5c21a7 100644 --- a/modules/base_installation/files/cronie/puppet-post-merge +++ b/modules/base_installation/files/cronie/puppet-post-merge | |||
@@ -1,7 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | ## Run Puppet locally using puppet apply | 2 | ## Run Puppet locally using puppet_apply |
3 | git submodule update --init | 3 | git submodule update --init |
4 | /usr/bin/puppet apply `pwd`/manifests/site.pp | 4 | /usr/local/sbin/puppet_apply `pwd`/manifests/site.pp |
5 | 5 | ||
6 | ## Log status of the Puppet run | 6 | ## Log status of the Puppet run |
7 | if [ $? -eq 0 ] | 7 | if [ $? -eq 0 ] |
diff --git a/modules/base_installation/files/scripts/puppet_apply b/modules/base_installation/files/scripts/puppet_apply new file mode 100644 index 0000000..69673cc --- /dev/null +++ b/modules/base_installation/files/scripts/puppet_apply | |||
@@ -0,0 +1,23 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | lockfile=/var/run/puppet-apply.lock | ||
4 | path=`dirname $0` | ||
5 | path=`cd $path/..; pwd` | ||
6 | |||
7 | if [ $(id -u) -gt 0 ]; then | ||
8 | echo "You must be root to run this script." >&2 | ||
9 | exit 2 | ||
10 | fi | ||
11 | |||
12 | if (set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then | ||
13 | trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT | ||
14 | |||
15 | puppet apply "$@" | ||
16 | |||
17 | rm -f "$lockfile" | ||
18 | trap - INT TERM EXIT | ||
19 | else | ||
20 | echo "Failed to acquire lockfile: $lockfile." >&2 | ||
21 | echo "Held by $(cat $lockfile 2>/dev/null)" >&2 | ||
22 | exit 1 | ||
23 | fi | ||
diff --git a/modules/base_installation/files/scripts/puppet_reset_and_apply b/modules/base_installation/files/scripts/puppet_reset_and_apply index 6743044..0350e6e 100644 --- a/modules/base_installation/files/scripts/puppet_reset_and_apply +++ b/modules/base_installation/files/scripts/puppet_reset_and_apply | |||
@@ -11,4 +11,4 @@ fi | |||
11 | git reset --hard origin/$branch | 11 | git reset --hard origin/$branch |
12 | 12 | ||
13 | git submodule update --init | 13 | git submodule update --init |
14 | puppet apply --test manifests/site.pp | 14 | puppet_apply --test manifests/site.pp |