Skip to content

Instantly share code, notes, and snippets.

@alapidas
Created November 24, 2014 23:31
Show Gist options
  • Select an option

  • Save alapidas/fd2345970f05d6d8853a to your computer and use it in GitHub Desktop.

Select an option

Save alapidas/fd2345970f05d6d8853a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#
# This should be run as the zenoss user
set -x
function die { echo "ERROR: ${*}" >&2; exit 1; }
function testcase_die { die "Test case #$TESTCASE failed!" }
$ZENHOME/bin/zeneventserver start
[ -n "$(which zencatalogservice 2>/dev/null)" ] && zencatalogservice start
sleep 3
if [[ $# > 0 && $1 == zenpack ]]; then
ZPDIR=/mnt/src/zenpacks
for ZP in ZenPacks.zenoss.ApacheMonitor; do
# Set up (install some packs for real, not linked)
cd "$ZPDIR"/"$ZP"
rm -rf dist/*
python setup.py bdist_egg
cd distf
zenpack --install *.egg || die "Unable to install zenpack $ZP"
# 1) Customer installs a zenpack then pulls a new image,
# the new image does not have the zenpack
TESTCASE=1
pip uninstall -y ZenPacks.zenoss.ApacheMonitor || die "'pip uninstall' failed!"
# Make sure zenpack is properly broken
zenpack --list | grep -q "ZenPacks.zenoss.ApacheMonitor (zenpack missing)" || testcase_die
# Now fix it
zenpack --restore || testcase_die
zenpack --list | grep -qv "ZenPacks.zenoss.ApacheMonitor (zenpack missing)" || testcase_die
done
else
exec $ZENHOME/bin/runtests $@
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment