aboutsummaryrefslogtreecommitdiffstats
path: root/extraconfig/tasks/run_puppet.sh
diff options
context:
space:
mode:
authorSofer Athlan-Guyot <sathlang@redhat.com>2017-02-14 14:20:23 +0100
committerMarios Andreou <marios@redhat.com>2017-02-17 09:39:26 +0000
commit3440d9d8caa26f0360be9d9d6110ff46e6e8ddb6 (patch)
treecc0de934a114e58c54fe1a6f158eb9fae0fb4505 /extraconfig/tasks/run_puppet.sh
parentaef946f8453d81b8bb6b20f5539e5949209af8a9 (diff)
Apply puppet in non-controller script in step.
We want to apply a puppet manifest for the non-controller role, but we need to apply it in stages. By loading the proper hieradata we get the needed step configuration. Change-Id: I07bfeee7b7d9a9b8c2c20e5d5c9ed735d0bfc842 Closes-Bug: #1664304 (cherry picked from commit 237cd2004a2c0869d60d0e11e9dccd59e809ff90)
Diffstat (limited to 'extraconfig/tasks/run_puppet.sh')
-rwxr-xr-xextraconfig/tasks/run_puppet.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/extraconfig/tasks/run_puppet.sh b/extraconfig/tasks/run_puppet.sh
new file mode 100755
index 00000000..b7771e33
--- /dev/null
+++ b/extraconfig/tasks/run_puppet.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+function run_puppet {
+ set -eux
+ local manifest="$1"
+ local role="$2"
+ local step="$3"
+ local rc=0
+
+ export FACTER_deploy_config_name="${role}Deployment_Step${step}"
+ if [ -e "/etc/puppet/hieradata/heat_config_${FACTER_deploy_config_name}.json" ]; then
+ set +e
+ puppet apply --detailed-exitcodes "${manifest}"
+ rc=$?
+ echo "puppet apply exited with exit code $rc"
+ else
+ echo "Step${step} doesn't exist for ${role}"
+ fi
+ set -e
+
+ if [ $rc -eq 2 -o $rc -eq 0 ]; then
+ set +xu
+ return 0
+ fi
+ set +xu
+ return $rc
+}