[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#942102: Adding this other patch



Hi,

I also would like to add the attached patch to the package. Indeed, when
upgrading Neutron in non-interactive mode, annoyingly this may change
the content of neutron.conf. With the added patch, this cannot happen
anymore. Note that this has been included in the Sid package for quite
some time, and that I've been using such a fix in production already, so
it's been tested extensively.

Cheers,

Thomas Goirand (zigo)
>From 2dda54a0519e9d17c0c2262a6701529c479031ce Mon Sep 17 00:00:00 2001
From: Thomas Goirand <zigo@debian.org>
Date: Mon, 14 Oct 2019 02:15:35 +0200
Subject: [PATCH 1340/1345]   * Add the neccessary debconf stuff to stop modifying config files on     upgrades.

diff --git a/debian/neutron-common.config.in b/debian/neutron-common.config.in
index f8f0d3b50b..99e010bff7 100644
--- a/debian/neutron-common.config.in
+++ b/debian/neutron-common.config.in
@@ -8,11 +8,19 @@ N_CONF=/etc/neutron/neutron.conf
 ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini
 
 read_nova_admin_credentials () {
-	pkgos_read_config -p high ${N_CONF} nova auth_url neutron/nova_auth_url
-	pkgos_read_config -p high ${N_CONF} nova region_name neutron/nova_region
-	pkgos_read_config -p medium ${N_CONF} nova project_name neutron/nova_service_project_name
-	pkgos_read_config -p medium ${N_CONF} nova username neutron/nova_service_username
-	pkgos_read_config -p high ${N_CONF} nova password neutron/nova_service_password
+	db_get neutron/configure_ksat
+	if  [ "${RET}" = "true" ] ; then
+		db_input high neutron/configure_nova || true
+		db_go
+		db_get neutron/configure_nova
+		if  [ "${RET}" = "true" ] ; then
+			pkgos_read_config -p high ${N_CONF} nova auth_url 	neutron/nova_auth_url
+			pkgos_read_config -p high ${N_CONF} nova region_name 	neutron/nova_region
+			pkgos_read_config -p medium ${N_CONF} nova project_name neutron/nova_service_project_name
+			pkgos_read_config -p medium ${N_CONF} nova username 	neutron/nova_service_username
+			pkgos_read_config -p high ${N_CONF} nova password 	neutron/nova_service_password
+		fi
+	fi
 }
 
 #PKGOS-INCLUDE#
diff --git a/debian/neutron-common.postinst.in b/debian/neutron-common.postinst.in
index a30ffff18f..f914a291bd 100755
--- a/debian/neutron-common.postinst.in
+++ b/debian/neutron-common.postinst.in
@@ -83,7 +83,10 @@ if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
 		su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
 	fi
 
-	write_nova_service_credentials
+	db_get neutron/configure_nova
+	if  [ "${RET}" = "true" ] ; then
+		write_nova_service_credentials
+	fi
 	db_stop
 
 	# The /var/lib/neutron/dhcp needs to be readable from the nobody user.
diff --git a/debian/neutron-common.templates.in b/debian/neutron-common.templates.in
index df649181a6..0f19b3d6c8 100644
--- a/debian/neutron-common.templates.in
+++ b/debian/neutron-common.templates.in
@@ -7,6 +7,14 @@
 # Even minor modifications require translation updates and such
 # changes should be coordinated with translators and reviewers.
 
+Template: neutron/configure_nova
+Type: boolean
+Default: false
+_Description: Manage nova config through debconf?
+ Neutron service must contact Nova, and this is configured through
+ the [nova] section of the configuration. Specify if you wish
+ to handle this configuration through debconf.
+
 Template: neutron/nova_auth_url
 Type: string
 Default: http://127.0.0.1:5000
diff --git a/debian/neutron-metadata-agent.config.in b/debian/neutron-metadata-agent.config.in
index 260ef3e28d..ccabc3843e 100644
--- a/debian/neutron-metadata-agent.config.in
+++ b/debian/neutron-metadata-agent.config.in
@@ -10,7 +10,13 @@ META_AGNT_CONF=/etc/neutron/metadata_agent.ini
 
 pkgos_var_user_group neutron
 chmod 755 /var/lib/neutron
-pkgos_read_config -p high ${META_AGNT_CONF} DEFAULT metadata_proxy_shared_secret neutron-metadata/metadata_secret
-pkgos_read_config -p high ${META_AGNT_CONF} DEFAULT nova_metadata_host neutron-metadata/nova_metadata_host
+
+db_input high neutron-metadata/configure || true
+db_go
+db_get neutron-metadata/configure
+if [ "${RET}" = "true" ] ; then
+	pkgos_read_config -p high ${META_AGNT_CONF} DEFAULT metadata_proxy_shared_secret neutron-metadata/metadata_secret
+	pkgos_read_config -p high ${META_AGNT_CONF} DEFAULT nova_metadata_host neutron-metadata/nova_metadata_host
+fi
 
 exit 0
diff --git a/debian/neutron-metadata-agent.postinst.in b/debian/neutron-metadata-agent.postinst.in
index eb1f4c43d8..8615adbb26 100755
--- a/debian/neutron-metadata-agent.postinst.in
+++ b/debian/neutron-metadata-agent.postinst.in
@@ -21,7 +21,10 @@ if [ "${1}" = "configure" ] ; then
 	if [ ! -e ${CONF_FILE} ] ; then
 		install -D -m 0640 -o neutron -g neutron /usr/share/neutron-metadata-agent/metadata_agent.ini ${CONF_FILE}
 	fi
-	manage_metadata_proxy_shared_secret
+	db_get neutron-metadata/configure
+	if [ "${RET}" = "true" ] ; then
+		manage_metadata_proxy_shared_secret
+	fi
 	db_stop
 fi
 
diff --git a/debian/neutron-metadata-agent.templates b/debian/neutron-metadata-agent.templates
index 8addb39399..7dae916d57 100644
--- a/debian/neutron-metadata-agent.templates
+++ b/debian/neutron-metadata-agent.templates
@@ -7,6 +7,13 @@
 # Even minor modifications require translation updates and such
 # changes should be coordinated with translators and reviewers.
 
+Template: neutron-metadata/configure
+Type: boolean
+Default: false
+_Description: Manage Neutron metadata config through debconf?
+ Neutron Metadata service must be configured to contact Nova.
+ Specify if you wish to handle this configuration through debconf.
+
 Template: neutron-metadata/metadata_secret
 Type: password
 _Description: Metadata proxy shared secret:
-- 
2.20.1


Reply to: