Create puppet folder layout

* create fixtures directory that will contain manifests to run.
* Add an empty scenario001.pp file to ensure our gate is properly working.

This implementation is basic and is not definitive. It aims to scale-up
later once we have multiple scenarios.

Change-Id: I0149c7887c8e664ca895be8ce4df5f620c5c6d0c
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-07-13 15:04:45 -04:00 committed by Emilien Macchi
parent b3358f78fa
commit 8348afb6fc
2 changed files with 47 additions and 1 deletions

17
fixtures/scenario001.pp Normal file

@ -0,0 +1,17 @@
#
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
notice('Successful Puppet run')

@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash -ex
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -19,3 +19,32 @@ if [ $(id -u) != 0 ]; then
fi
$SUDO ./install_modules.sh
PUPPET_ARGS="--detailed-exitcodes --verbose --color=false --debug"
function run_puppet() {
local manifest=$1
$SUDO puppet apply $PUPPET_ARGS fixtures/${manifest}.pp
local res=$?
return $res
}
# Run puppet and assert something changes.
set +e
run_puppet scenario001
RESULT=$?
set -e
if [ $RESULT -ne 2 ]; then
exit 1
fi
# Run puppet a second time and assert nothing changes.
set +e
run_puppet scenario001
RESULT=$?
set -e
if [ $RESULT -ne 0 ]; then
exit 1
fi