diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-02-17 09:29:01 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-02-17 09:29:01 +0000 |
commit | fcda1872cf51df0325680edb6e7f2c9dcfaa3c2c (patch) | |
tree | 33a15febba01b71d097b81a6217a49c09fbed309 /extraconfig | |
parent | 4fd12f1d18eaee79a299102df370281acf4dfac3 (diff) | |
parent | 237cd2004a2c0869d60d0e11e9dccd59e809ff90 (diff) |
Merge "Apply puppet in non-controller script in step."
Diffstat (limited to 'extraconfig')
-rwxr-xr-x | extraconfig/tasks/run_puppet.sh | 27 | ||||
-rw-r--r-- | extraconfig/tasks/tripleo_upgrade_node.sh | 11 |
2 files changed, 35 insertions, 3 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 +} diff --git a/extraconfig/tasks/tripleo_upgrade_node.sh b/extraconfig/tasks/tripleo_upgrade_node.sh index 27ba33a8..16584254 100644 --- a/extraconfig/tasks/tripleo_upgrade_node.sh +++ b/extraconfig/tasks/tripleo_upgrade_node.sh @@ -44,9 +44,14 @@ if [[ -n \$NOVA_COMPUTE ]]; then systemctl restart openstack-ceilometer-compute fi -# Apply puppet manifest to converge just right after the \$ROLE upgrade -puppet apply /root/${ROLE}_puppet_config.pp - +# Apply puppet manifest to converge just right after the ${ROLE} upgrade +$(declare -f run_puppet) +for step in 1 2 3 4 5 6; do + if ! run_puppet /root/${ROLE}_puppet_config.pp ${ROLE} \${step}; then + echo "Puppet failure at step \${step}" + exit 1 + fi +done ENDOFCAT # ensure the permissions are OK |