tripleo-heat-templates/extraconfig/tasks/run_puppet.sh
Sofer Athlan-Guyot 79c2d0f3d4 N->O Manual puppet commands have the right modulepath.
In two places during upgrade we manually trigger puppet.

There can be a problem when new puppet modules are added, and their
corresponding symlinks in /etc/puppet/modules are not created during
the installation as their are installed in
/usr/share/openstack-puppet/modules.  To prevent the issue tripleo set
modulepath in the templates.

We must use the same modulepath to make sure that we don't fail
because of missing module in the manual puppet run.

This particulary happens when you upgrade from M->N->O, as the base
image in Mitaka doesn't have the proper symlinks and they are not
created during the installation of the package.

Closes-Bug: #1684587

Change-Id: I79df6ea33f1c58e13309176a6de41b7572541fd6
2017-04-20 13:20:41 +02:00

31 lines
762 B
Bash
Executable File

#!/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 \
--modulepath \
/etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules \
"${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
}