snap-gnocchi/tests/gnocchi_setup.sh
Corey Bryant 267811c32b Various updates to get snap and tests working
* Drop gnocchi.conf from snap source in favor of installing it (as well as
  api-paste.ini and policy.json) from upstream source.
* Drop gnocchi-api entry point in favor of using gnocchi-uwsgi and
  gnocchi-nginx to serve API requests.
* Move to gnocchi 4.0.2 source.
* Update gnocchi-snap.conf.j2 template with $SNAP_COMMON paths.
* Add statsd and change-sack-size entry points and modify existing entry
  points to use snap-openstack.
* Add test configs that enable a working gnocchi.
* Enhance test scripts and split into separate scripts.
* Bring back oslo-config-dirs.patch and upper constraints as they're
  needed for ocata.
2017-09-05 18:34:08 +00:00

42 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -ex
source $BASE_DIR/admin-openrc
DEBIAN_FRONTEND='noninteractive' sudo -E apt install --yes python-gnocchiclient
sudo mysql -u root << EOF
CREATE DATABASE IF NOT EXISTS gnocchi;
GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'localhost' \
IDENTIFIED BY 'gnocchi';
GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'%' \
IDENTIFIED BY 'gnocchi';
EOF
while sudo [ ! -d /var/snap/gnocchi/common/etc/gnocchi/ ]; do sleep 0.1; done;
sudo cp -r $BASE_DIR/etc/snap-gnocchi/* /var/snap/gnocchi/common/etc/
openstack user show gnocchi || {
openstack user create --domain default --password gnocchi gnocchi
openstack role add --project service --user gnocchi admin
}
openstack service show metric || {
openstack service create --name gnocchi --description "Metric Service" metric
for endpoint in internal admin public; do
openstack endpoint create --region RegionOne \
metric $endpoint http://localhost:8041 || :
done
}
# Manually define alias if snap isn't installed from snap store.
# Otherwise, snap store defines this alias automatically.
snap aliases gnocchi | grep gnocchi-upgrade || sudo snap alias gnocchi.upgrade gnocchi-upgrade
sudo gnocchi-upgrade
sudo systemctl restart snap.gnocchi.*
while ! nc -z localhost 8041; do sleep 0.1; done;