Hello,
Here is a new version of the patch.

I removed /etc/mcollective/{server,client}.cfg from package distribution
to avoid dpkg asking for replacement.
Then, to ensure config file upgrade while trying to keep as most user
modifications as possible, I added some sed commands into postinst
script to:
- change connector to activemq, only if stomp was used (stomp has been
deprecated since mcollective 2.2.0)
- for all stomp options, keep eventual user modification except for port
number (I assumed most people do not change default port for services
like stomp or activemq).

Do not hesitate if you have any question.

Regards,
Jean Baptiste
diff -Nru mcollective-2.6.0+dfsg/debian/changelog mcollective-2.6.0+dfsg/debian/changelog
--- mcollective-2.6.0+dfsg/debian/changelog	2014-10-14 14:18:57.000000000 +0200
+++ mcollective-2.6.0+dfsg/debian/changelog	2014-11-16 21:54:49.000000000 +0100
@@ -1,3 +1,13 @@
+mcollective (2.6.0+dfsg-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Remove server & client config files from package to avoid dpkg asking for
+    replacement
+  * Try to change server.cfg and client.cfg default connector, while keeping
+    user values in postinst. (Closes: #767936)
+
+ -- Jean Baptiste Favre <deb...@jbfavre.org>  Fri, 14 Nov 2014 18:12:24 +0100
+
 mcollective (2.6.0+dfsg-1) unstable; urgency=low
 
   * Imported Upstream version 2.6.0+dfsg
diff -Nru mcollective-2.6.0+dfsg/debian/mcollective-client.dirs mcollective-2.6.0+dfsg/debian/mcollective-client.dirs
--- mcollective-2.6.0+dfsg/debian/mcollective-client.dirs	2014-10-14 14:18:57.000000000 +0200
+++ mcollective-2.6.0+dfsg/debian/mcollective-client.dirs	2014-11-16 20:01:01.000000000 +0100
@@ -1,2 +1,3 @@
 etc/mcollective
+usr/share/mcollective-client
 usr/bin
diff -Nru mcollective-2.6.0+dfsg/debian/mcollective-client.postinst mcollective-2.6.0+dfsg/debian/mcollective-client.postinst
--- mcollective-2.6.0+dfsg/debian/mcollective-client.postinst	2014-10-14 14:18:57.000000000 +0200
+++ mcollective-2.6.0+dfsg/debian/mcollective-client.postinst	2014-11-16 21:44:25.000000000 +0100
@@ -8,6 +8,17 @@
 	configure)
 		if [ ! -e "$MCOLLECTIVE_CLIENT_CFG" ]; then
 			cp /usr/share/mcollective-client/client.cfg $MCOLLECTIVE_CLIENT_CFG
+                else
+                        # try to update config file values
+                        # remove deprecated voncif goption
+                        sed -i 's/^topicprefix.*$//g' $MCOLLECTIVE_CLIENT_CFG
+                        # change default connector. previous one "stomp" has been deprecated since 2.2.0
+                        sed -i 's/^connector = stomp/connector = activemq\nplugin.activemq.pool.size = 1/g' $MCOLLECTIVE_CLIENT_CFG
+                        # change stomp options to activemq ones, keeping user values
+                        sed -i 's/^plugin.stomp.host=\(.*\)$/plugin.activemq.pool.1.host = \1/g' $MCOLLECTIVE_CLIENT_CFG
+                        sed -i 's/^plugin.stomp.port=.*$/plugin.activemq.pool.1.port = 61613/g' $MCOLLECTIVE_CLIENT_CFG
+                        sed -i 's/^plugin.stomp.user=\(.*\)$/plugin.activemq.pool.1.user = \1/g' $MCOLLECTIVE_CLIENT_CFG
+                        sed -i 's/^plugin.stomp.password=\(.*\)/plugin.activemq.pool.1.password = \1/g' $MCOLLECTIVE_CLIENT_CFG
 		fi
 
 		chmod 600 $MCOLLECTIVE_CLIENT_CFG
diff -Nru mcollective-2.6.0+dfsg/debian/mcollective.dirs mcollective-2.6.0+dfsg/debian/mcollective.dirs
--- mcollective-2.6.0+dfsg/debian/mcollective.dirs	2014-10-14 14:18:57.000000000 +0200
+++ mcollective-2.6.0+dfsg/debian/mcollective.dirs	2014-11-16 20:01:01.000000000 +0100
@@ -1,2 +1,3 @@
 etc/mcollective
+usr/share/mcollective
 usr/sbin
diff -Nru mcollective-2.6.0+dfsg/debian/mcollective.postinst mcollective-2.6.0+dfsg/debian/mcollective.postinst
--- mcollective-2.6.0+dfsg/debian/mcollective.postinst	2014-11-16 19:58:29.000000000 +0100
+++ mcollective-2.6.0+dfsg/debian/mcollective.postinst	2014-11-16 21:44:11.000000000 +0100
@@ -14,17 +14,17 @@
 	configure)
 		if [ ! -e "$MCOLLECTIVE_SERVER_CFG" ]; then
 			cp /usr/share/mcollective/server.cfg $MCOLLECTIVE_SERVER_CFG
+                else
+                        # try to update config file values
+                        # remove deprecated voncif goption
+                        sed -i 's/^topicprefix.*$//g' $MCOLLECTIVE_SERVER_CFG
+                        # change default connector. previous one "stomp" has been deprecated since 2.2.0
+                        sed -i 's/^connector = stomp/connector = activemq\nplugin.activemq.pool.size = 1/g' $MCOLLECTIVE_SERVER_CFG
+                        # change stomp options to activemq ones, keeping user values
+                        sed -i 's/^plugin.stomp.host=\(.*\)$/plugin.activemq.pool.1.host = \1/g' $MCOLLECTIVE_SERVER_CFG
+                        sed -i 's/^plugin.stomp.port=.*$/plugin.activemq.pool.1.port = 61613/g' $MCOLLECTIVE_SERVER_CFG
+                        sed -i 's/^plugin.stomp.user=\(.*\)$/plugin.activemq.pool.1.user = \1/g' $MCOLLECTIVE_SERVER_CFG
+                        sed -i 's/^plugin.stomp.password=\(.*\)/plugin.activemq.pool.1.password = \1/g' $MCOLLECTIVE_SERVER_CFG
 		fi
 
 		chmod 600 $MCOLLECTIVE_SERVER_CFG
diff -Nru mcollective-2.6.0+dfsg/debian/rules mcollective-2.6.0+dfsg/debian/rules
--- mcollective-2.6.0+dfsg/debian/rules	2014-10-14 14:18:57.000000000 +0200
+++ mcollective-2.6.0+dfsg/debian/rules	2014-11-16 20:01:01.000000000 +0100
@@ -4,8 +4,8 @@
 	dh $@ --buildsystem=ruby --with ruby,systemd
 
 override_dh_auto_install:
-	cp $(CURDIR)/etc/server.cfg.dist $(CURDIR)/debian/mcollective/etc/mcollective/server.cfg
-	cp $(CURDIR)/etc/client.cfg.dist $(CURDIR)/debian/mcollective-client/etc/mcollective/client.cfg
+	cp $(CURDIR)/etc/server.cfg.dist $(CURDIR)/debian/mcollective/usr/share/mcollective/server.cfg
+	cp $(CURDIR)/etc/client.cfg.dist $(CURDIR)/debian/mcollective-client/usr/share/mcollective-client/client.cfg
 	cp $(CURDIR)/etc/facts.yaml.dist $(CURDIR)/debian/mcollective-common/etc/mcollective/facts.yaml
 	cp $(CURDIR)/etc/rpc-help.erb $(CURDIR)/debian/mcollective-common/etc/mcollective/rpc-help.erb
 	cp -R  $(CURDIR)/lib/* $(CURDIR)/debian/mcollective-common/usr/lib/ruby/vendor_ruby/

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to