
This commit takes the cookie cutter output and fixes it up into a snap that builds and installs. - Added required names and such in openstack-snap.yaml and nginx and wsgi config templates. - Python packages that are declared in setup.cfg and not in requirements.txt are now called out explicitly in the snapcraft.yaml. (Note: a better fix might be to update snapcraft to be able to parse dependencies from setup.cfg.) - Removed upper constraints files on Python packages (and removed oslo patch). Gnocchi does not appear to respect the upper constraints. - Added gnocchi-config-generator command to apps. - Used the above to generate a default config. - Added snapstack tests (though they don't work yet). There's still plenty to do: snapstack tests need to be fixed up (see the TODO in tests/gnocchi.sh), and the snap as a whole needs to be thoroughly tested.
44 lines
1.1 KiB
Bash
44 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
DAEMONS=('snap.gnocchi.api.service', 'snap.gnocchi.metricd.service')
|
|
ret=0
|
|
|
|
sudo mysql -u root <<EOF
|
|
DROP DATABASE IF EXISTS gnocchi;
|
|
CREATE DATABASE gnocchi;
|
|
GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'localhost' \
|
|
IDENTIFIED BY 'changeme';
|
|
GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'%' \
|
|
IDENTIFIED BY 'changeme';
|
|
EOF
|
|
|
|
while sudo [ ! -d /var/snap/gnocchi/common/etc/gnocchi/ ]; do sleep 0.1; done;
|
|
# TODO: this may not be the right dir -- gnocchi doesn't seem to be
|
|
# able to see the indexer url that we set (or it might just be the
|
|
# wrong file).
|
|
sudo cp -r $BASE_DIR/etc/snap-gnocchi/* /var/snap/gnocchi/common/etc/
|
|
|
|
gnocchi.gnocchi-upgrade
|
|
|
|
for daemon in "${DAEMONS[@]}"; do
|
|
systemctl restart $daemon
|
|
TIMEOUT=50
|
|
while [ "$TIMEOUT" -gt 0 ]; do
|
|
if systemctl is-active $daemon > /dev/null; then
|
|
echo "OK"
|
|
break
|
|
fi
|
|
TIMEOUT=$((TIMEOUT - 1))
|
|
sleep 0.1
|
|
done
|
|
|
|
if [ "$TIMEOUT" -le 0 ]; then
|
|
echo "ERROR: ${daemon} IS NOT RUNNING"
|
|
ret=1
|
|
fi
|
|
done
|
|
|
|
exit $ret
|