This commit is contained in:
Fredrik Thulin 2019-01-15 13:08:39 +01:00
parent a2e4c5372f
commit bf1b476d9a
No known key found for this signature in database
GPG key ID: 2707330D4030CCAD

View file

@ -8,6 +8,9 @@ export GNUPGHOME=/etc/cosmos/gnupg
python -c "import yaml" 2>/dev/null || apt-get -y install python-yaml python -c "import yaml" 2>/dev/null || apt-get -y install python-yaml
bold='\e[1m'
reset='\e[0m'
red='\033[01;31m'
stage_module() { stage_module() {
rm -rf $CACHE_DIR/staging/$1 rm -rf $CACHE_DIR/staging/$1
@ -43,16 +46,14 @@ if [ -f $CONFIG -o $LOCALCONFIG ]; then
continue continue
fi fi
else else
echo "ERROR: Ignoring non-git repository" echo -e "${red}ERROR: Ignoring non-git repository${reset}"
continue continue
fi fi
elif [[ "$src" =~ .*:// ]]; then elif [[ "$src" =~ .*:// ]]; then
echo "ERROR: Don't know how to install '$src'" echo -e "${red}ERROR: Don't know how to install '${src}'${reset}"
continue continue
else else
echo "WARNING" echo -e "${bold}WARNING - attempting UNSAFE installation/upgrade of puppet-module ${module} from ${src}${reset}"
echo "WARNING - attempting UNSAFE installation/upgrade of puppet-module $module from $src"
echo "WARNING"
if [ ! -d /etc/puppet/modules/$module ]; then if [ ! -d /etc/puppet/modules/$module ]; then
puppet module install $src puppet module install $src
elif [ "$update" = "yes" ]; then elif [ "$update" = "yes" ]; then
@ -72,26 +73,24 @@ if [ -f $CONFIG -o $LOCALCONFIG ]; then
cd $CACHE_DIR/scm/$module cd $CACHE_DIR/scm/$module
TAG=$(git tag -l "${pattern:-*}" | sort | tail -1) TAG=$(git tag -l "${pattern:-*}" | sort | tail -1)
if [ "$COSMOS_VERBOSE" = "y" ]; then if [ "$COSMOS_VERBOSE" = "y" ]; then
echo "" echo -e "Checking signature on puppet-module:tag ${bold}${module}:${TAG}${reset}"
echo "Checking signature on tag ${TAG} for puppet-module $module"
fi fi
if [ -z "$TAG" ]; then if [ -z "$TAG" ]; then
echo "ERROR: No git tag found for pattern '${pattern:-*}' on puppet-module $module" echo -e "${red}ERROR: No git tag found for pattern '${pattern:-*}' on puppet-module ${module}${reset}"
continue continue
fi fi
git tag -v $TAG &> /dev/null git tag -v $TAG &> /dev/null
if [ $? == 0 ]; then if [ $? == 0 ]; then
if [ "$COSMOS_VERBOSE" = "y" ]; then #if [ "$COSMOS_VERBOSE" = "y" ]; then
# short output on good signature # # short output on good signature
git tag -v $TAG 2>&1 | grep "gpg: Good signature" # git tag -v $TAG 2>&1 | grep "gpg: Good signature"
fi #fi
# Put archive in staging since tag verified OK # Put archive in staging since tag verified OK
stage_module $module $TAG stage_module $module $TAG
else else
echo "################################################################" echo -e "${red}FAILED signature check on puppet-module ${module}${reset}"
echo "FAILED signature check on puppet-module $module"
echo "################################################################"
git tag -v $TAG git tag -v $TAG
echo ''
fi fi
fi fi
done done