Fixed ceilometer-common.postinst.
[openstack-build/ceilometer-build.git] / xenial / debian / ceilometer-common.postinst.in
index a8fb13a1c398d672dd17d6389a631fce2396789c..623271b3d33ef4809480c44ac76e3497a34a7e11 100644 (file)
@@ -6,10 +6,16 @@ set -e
 
 # We need to do that for ceilometer-agent-compute
 libvirt_user_group () {
-       if dpkg-vendor --derives-from ubuntu ; then
+       if getent group libvirt ; then
+               LIBVIRT_GROUP=libvirt
+       elif getent group libvirtd ; then
                LIBVIRT_GROUP=libvirtd
        else
-               LIBVIRT_GROUP=libvirt
+               if dpkg-vendor --derives-from ubuntu ; then
+                       LIBVIRT_GROUP=libvirtd
+               else
+                       LIBVIRT_GROUP=libvirt
+               fi
        fi
 
        if ! getent group ${LIBVIRT_GROUP} >/dev/null; then
@@ -42,12 +48,14 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
        adduser ceilometer nova || true
        adduser ceilometer ${LIBVIRT_GROUP} || true
        pkgos_write_new_conf ceilometer ceilometer.conf
-       pkgos_write_new_conf ceilometer policy.json
-       pkgos_write_new_conf ceilometer sources.json
-       pkgos_write_new_conf ceilometer pipeline.yaml
-       pkgos_rabbit_write_conf /etc/ceilometer/ceilometer.conf DEFAULT ceilometer
+       pkgos_rabbit_write_conf /etc/ceilometer/ceilometer.conf oslo_messaging_rabbit ceilometer
        pkgos_write_admin_creds /etc/ceilometer/ceilometer.conf keystone_authtoken ceilometer
-       ceilometer-dbsync || true
+       db_get ceilometer/configure_db
+       if [ "$RET" = "true" ]; then
+               ceilometer-dbsync || true
+       fi
 fi
 
 #DEBHELPER#
+
+exit 0