Use ansible for puppet apply test
This is needed since the hiera configuration is in the ansible role. Have puppet append its output directly to our per-test output file. Rename that file with a FAILED suffix for easy identification when looking at the results in the published log directory. Change-Id: Ie2a028b9e0179168d279bcf33de7f997cdfdbc8d Depends-On: I0db01d128258f78e9b196354799a80774f6c6808
This commit is contained in:
parent
fd5915ede2
commit
a01bec1fc6
@ -63,6 +63,7 @@ sudo mkdir -p /var/run/puppet
|
||||
sudo -E bash -x ./install_modules.sh
|
||||
echo "Running apply test on these hosts:"
|
||||
find applytest -name 'puppetapplytest*.final' -print0
|
||||
# TODO: restore the use of "-P $(nproc)" for parallel testing
|
||||
find applytest -name 'puppetapplytest*.final' -print0 | \
|
||||
xargs -0 -P $(nproc) -n 1 -I filearg \
|
||||
xargs -0 -n 1 -I filearg \
|
||||
./tools/test_puppet_apply.sh filearg
|
||||
|
@ -31,6 +31,8 @@ cat > clonemap.yaml <<EOF
|
||||
clonemap:
|
||||
- name: '(.*?)/puppet-(.*)'
|
||||
dest: '/etc/puppet/modules/\2'
|
||||
- name: '(.*?)/ansible-role-(.*)'
|
||||
dest: '/etc/ansible/roles/\2'
|
||||
EOF
|
||||
|
||||
# These arrays are initialized here and populated in modules.env
|
||||
@ -47,7 +49,7 @@ declare -A SOURCE_MODULES
|
||||
declare -A INTEGRATION_MODULES
|
||||
|
||||
|
||||
project_names=""
|
||||
project_names="openstack-infra/ansible-role-puppet"
|
||||
|
||||
source $MODULE_ENV_FILE
|
||||
|
||||
@ -66,12 +68,10 @@ HOST=`echo $HOSTNAME |awk -F. '{ print $1 }'`
|
||||
echo "127.0.1.1 $HOST.openstack.org $HOST" >> /tmp/hosts
|
||||
sudo mv /tmp/hosts /etc/hosts
|
||||
|
||||
# Manage hiera
|
||||
# Set up the production config directory, and then let ansible take care
|
||||
# of configuring hiera.
|
||||
sudo mkdir -p /opt/system-config
|
||||
sudo ln -s $(pwd) /opt/system-config/production
|
||||
sudo cp modules/openstack_project/files/puppet/hiera.yaml /etc/hiera.yaml
|
||||
sudo cp modules/openstack_project/files/puppet/hiera.yaml /etc/puppet/hiera.yaml
|
||||
sudo ln -sf $(pwd) /opt/system-config/production
|
||||
|
||||
# Demonstrate that hiera lookups are functioning
|
||||
find /opt/system-config/production/hiera
|
||||
hiera -c /etc/puppet/hiera.yaml -d elasticsearch_nodes ::environment=production
|
||||
virtualenv --system-site-packages /tmp/apply-ansible-env
|
||||
/tmp/apply-ansible-env/bin/pip install ansible
|
||||
|
@ -18,7 +18,9 @@ file=$1
|
||||
fileout=${file}.out
|
||||
echo "##" > $fileout
|
||||
cat $file > $fileout
|
||||
sudo puppet apply --modulepath=${MODULE_PATH} --color=false --noop --verbose --debug $file >/dev/null 2>> $fileout
|
||||
sudo /tmp/apply-ansible-env/bin/ansible-playbook -f1 --limit localhost playbooks/remote_puppet_adhoc.yaml -e puppet_environment=production -e manifest=`pwd`/$file -e puppet_noop=true -e puppet_logdest=`pwd`/$fileout
|
||||
ret=$?
|
||||
cat $fileout
|
||||
if [ $ret -ne 0 ]; then
|
||||
mv $fileout $fileout.FAILED
|
||||
fi
|
||||
exit $ret
|
||||
|
Loading…
x
Reference in New Issue
Block a user