X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=trusty%2Fdebian%2Fceilometer-common.postinst.in;h=623271b3d33ef4809480c44ac76e3497a34a7e11;hb=07e067df4658bcc2f5a1e5a1ce1955dc120b47a7;hp=865d7d574b7a890bf2c932ddbcabb0635469ab45;hpb=70844ed0e793ff6b7c85a23c1f7d54dd7b7101da;p=openstack-build%2Fceilometer-build.git diff --git a/trusty/debian/ceilometer-common.postinst.in b/trusty/debian/ceilometer-common.postinst.in index 865d7d5..623271b 100644 --- a/trusty/debian/ceilometer-common.postinst.in +++ b/trusty/debian/ceilometer-common.postinst.in @@ -4,10 +4,58 @@ set -e #PKGOS-INCLUDE# -if [ "$1" = "configure" ]; then - pkgos_var_user_group nova +# We need to do that for ceilometer-agent-compute +libvirt_user_group () { + if getent group libvirt ; then + LIBVIRT_GROUP=libvirt + elif getent group libvirtd ; then + LIBVIRT_GROUP=libvirtd + else + if dpkg-vendor --derives-from ubuntu ; then + LIBVIRT_GROUP=libvirtd + else + LIBVIRT_GROUP=libvirt + fi + fi + + if ! getent group ${LIBVIRT_GROUP} >/dev/null; then + addgroup --system ${LIBVIRT_GROUP} + fi + + # user and group libvirt runs qemu/kvm instances with + if ! getent group kvm >/dev/null; then + addgroup --quiet --system kvm + fi + if ! getent passwd libvirt-qemu >/dev/null; then + adduser --quiet \ + --system \ + --ingroup kvm \ + --quiet \ + --disabled-login \ + --disabled-password \ + --home /var/lib/libvirt \ + --no-create-home \ + -gecos "Libvirt Qemu" \ + libvirt-qemu + fi +} + +if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then + . /usr/share/debconf/confmodule + pkgos_adduser nova pkgos_var_user_group ceilometer + libvirt_user_group adduser ceilometer nova || true + adduser ceilometer ${LIBVIRT_GROUP} || true + pkgos_write_new_conf ceilometer ceilometer.conf + pkgos_rabbit_write_conf /etc/ceilometer/ceilometer.conf oslo_messaging_rabbit ceilometer + pkgos_write_admin_creds /etc/ceilometer/ceilometer.conf keystone_authtoken ceilometer + db_get ceilometer/configure_db + if [ "$RET" = "true" ]; then + ceilometer-dbsync || true + fi fi #DEBHELPER# + +exit 0