From 0132377ad374c9d50ce5a494dffaa750e35b1c5d Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Fri, 26 Oct 2012 15:18:39 +0000 Subject: [PATCH] Copy of pkgos_func from glance. Rewritten-From: e561c1167beb94ea108b61b28b6fc931104cd651 --- xenial/debian/pkgos_func | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/xenial/debian/pkgos_func b/xenial/debian/pkgos_func index 96ba923a6..a2a92f5e7 100644 --- a/xenial/debian/pkgos_func +++ b/xenial/debian/pkgos_func @@ -265,8 +265,43 @@ pkgos_dbc_postinst () { fi } +# Reads auth_host, admin_tenant_name, admin_user and admin_password +# values with debconf +# Prototype: pkgos_read_admin_creds
+# Example calls: +# pkgos_read_admin_creds /etc/glance/glance-api.conf glance keystone_authtoken +# To be used in: config +pkgos_read_admin_creds () { + local CONF_FNAME PKG_NAME SECTION + CONF_FNAME=${1} + PKG_NAME=${2} + SECTION=${3} + + pkgos_read_config ${CONF_FNAME} auth_host ${PKG_NAME}/auth-host ${SECTION} + pkgos_read_config ${CONF_FNAME} admin_tenant_name ${PKG_NAME}/admin-tenant-name ${SECTION} + pkgos_read_config ${CONF_FNAME} admin_user ${PKG_NAME}/admin-user ${SECTION} + pkgos_read_config ${CONF_FNAME} admin_password ${PKG_NAME}/admin-password ${SECTION} +} + +# To be used in: postinst +pkgos_write_admin_creds () { + local CONF_FNAME PKG_NAME SECTION + CONF_FNAME=${1} + PKG_NAME=${2} + SECTION=${3} + + db_get ${PKG_NAME}/auth-host + pkgos_edit_config auth_host "${RET}" ${CONF_FNAME} ${SECTION} + db_get ${PKG_NAME}/admin-tenant-name + pkgos_edit_config admin_tenant_name "${RET}" ${CONF_FNAME} ${SECTION} + db_get ${PKG_NAME}/admin-user + pkgos_edit_config admin_user "${RET}" ${CONF_FNAME} ${SECTION} + db_get ${PKG_NAME}/admin-password + pkgos_edit_config admin_password "${RET}" ${CONF_FNAME} ${SECTION} +} + pkgos_write_new_conf () { - local PKG_NAME + local PKG_NAME CONF_FNAME PKG_NAME=${1} CONF_FNAME=${2} -- 2.45.2