]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Copy of pkgos_func from glance.
authorThomas Goirand <thomas@goirand.fr>
Fri, 26 Oct 2012 15:18:39 +0000 (15:18 +0000)
committerThomas Goirand <thomas@goirand.fr>
Fri, 26 Oct 2012 15:18:39 +0000 (15:18 +0000)
Rewritten-From: e561c1167beb94ea108b61b28b6fc931104cd651

xenial/debian/pkgos_func

index 96ba923a6335c64ba8625fc860050a9fc62d4372..a2a92f5e765719da84ea78c9def2cb56c6c688e6 100644 (file)
@@ -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 <conf-file> <PKG_NAME> <section>
+# 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}