File: cloudkitty-common.postinst.in

package info (click to toggle)
cloudkitty 17.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,144 kB
  • sloc: python: 19,245; sh: 374; makefile: 220; pascal: 54
file content (42 lines) | stat: -rwxr-xr-x 1,127 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh

set -e

ETC=/etc/cloudkitty
CONF=${ETC}/cloudkitty.conf

#PKGOS-INCLUDE#

if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
	. /usr/share/debconf/confmodule
	. /usr/share/dbconfig-common/dpkg/postinst

	pkgos_var_user_group cloudkitty

	# Make sure we have a /etc/cloudkitty folder with config files in it.
	pkgos_write_new_conf cloudkitty cloudkitty.conf
	pkgos_write_new_conf cloudkitty api_paste.ini
	if [ -r /etc/cloudkitty/policy.json ] ; then
		mv /etc/cloudkitty/policy.json /etc/cloudkitty/disabled.policy.json.old
	fi
	pkgos_write_new_conf cloudkitty metrics.yml


	pkgos_rabbit_write_conf ${CONF} oslo_messaging_rabbit cloudkitty
	pkgos_write_admin_creds ${CONF} keystone_authtoken cloudkitty

	# Do the db creation using dbconfig-common
	db_get cloudkitty/configure_db
	if [ "$RET" = "true" ] ; then
		pkgos_dbc_postinst ${CONF} database connection cloudkitty $@
		echo "Now doing cloudkitty-dbsync: this may take a while..."
		su cloudkitty -s /bin/sh -c "cloudkitty-storage-init" || true
		su cloudkitty -s /bin/sh -c "cloudkitty-dbsync upgrade" || true
	fi

	db_stop
fi

#DEBHELPER#

exit 0