Hi all,

I'd like to note that since 3.2.4-1, the package's maintainer scripts 
actually _remove_ /etc/default/puppet if it's unmodified or save it as 
/etc/default/puppet.dpkg-bak if it has been modified by the user. The 
latter means that even for sysvinit users where the initscript is 
functional, upgrading from wheezy to jessie will break their setups if 
they used /etc/default/puppet to pass daemon arguments.

In my understanding to fix all of these issues the following actions are 
required:

 - change puppet.service to read /etc/default/puppet and use 
   $DAEMON_OPTS.

 - remove the dpkg-maintscript-helper rm_conffile calls from the 
   maintainer scripts. We still will not be shipping 
   /etc/default/puppet, put we don't want to remove it since the 
   initscript and the systemd unit file will be using it if it exists.

 - apart from new installations, also disable the agent when upgrading 
   from pre-3.2.4-1 versions if /etc/default/puppet exists *and* $START 
   is not true.

If so, the attached patch should¹ fix this bug.

Regards,
Apollon

¹ still untested
diff --git a/debian/puppet-common.preinst b/debian/puppet-common.preinst
index 6039b2a..ea34e2a 100644
--- a/debian/puppet-common.preinst
+++ b/debian/puppet-common.preinst
@@ -18,7 +18,7 @@ disable_puppet_agent() {
     tmp_lockfile=$(mktemp /var/lib/puppet/state/agent_disabled.lock.XXXXXXXX)
     lockfile=/var/lib/puppet/state/agent_disabled.lock
 
-    printf '{"disabled_message":"Disabled by default on new installations"}' \
+    printf '{"disabled_message":"Disabled by default on new or unconfigured old installations"}' \
         > $tmp_lockfile
 
     mv $tmp_lockfile $lockfile
@@ -30,6 +30,17 @@ case "$1" in
         if [ -z "$2" ]; then
             disable_puppet_agent
         fi
+
+	if dpkg --compare-versions "$2" lt "3.2.4-1~" && \
+		[ -e "/etc/default/puppet" ]; then
+		. /etc/default/puppet
+
+		if [ "x$START" != "xtrue" -a "x$START" != "xyes" -a "x$START" != "x0" ]; then
+		    # Note that "0" is not a typo, it reflects the checks done
+		    # in wheezy's initscript.
+		    disable_puppet_agent
+		fi
+	fi
         ;;
 
     upgrade)
diff --git a/debian/puppet.postinst b/debian/puppet.postinst
deleted file mode 100644
index a04c65a..0000000
--- a/debian/puppet.postinst
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-# postinst script for puppet
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <postinst> `abort-remove'
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-    configure)
-    ;;
-
-    abort-upgrade|abort-remove|abort-deconfigure)
-    ;;
-
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-if dpkg-maintscript-helper supports rm_conffile; then
-    dpkg-maintscript-helper rm_conffile \
-        /etc/default/puppet 3.2.3-1 puppet -- "$@"
-fi
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff --git a/debian/puppet.postrm b/debian/puppet.postrm
deleted file mode 100644
index e0370f9..0000000
--- a/debian/puppet.postrm
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-# postrm script for puppet
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postrm> `remove'
-#        * <postrm> `purge'
-#        * <old-postrm> `upgrade' <new-version>
-#        * <new-postrm> `failed-upgrade' <old-version>
-#        * <new-postrm> `abort-install'
-#        * <new-postrm> `abort-install' <old-version>
-#        * <new-postrm> `abort-upgrade' <old-version>
-#        * <disappearer's-postrm> `disappear' <overwriter>
-#          <overwriter-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-        if dpkg-maintscript-helper supports rm_conffile; then
-            dpkg-maintscript-helper rm_conffile \
-                /etc/default/puppet 3.2.3-1 puppet -- "$@"
-        fi
-
-    ;;
-
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff --git a/debian/puppet.preinst b/debian/puppet.preinst
deleted file mode 100644
index 18b6061..0000000
--- a/debian/puppet.preinst
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# preinst script for #PACKAGE#
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <new-preinst> `install'
-#        * <new-preinst> `install' <old-version>
-#        * <new-preinst> `upgrade' <old-version>
-#        * <old-preinst> `abort-upgrade' <new-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-    install|upgrade)
-    ;;
-
-    abort-upgrade)
-    ;;
-
-    *)
-        echo "preinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-if dpkg-maintscript-helper supports rm_conffile; then
-    dpkg-maintscript-helper rm_conffile \
-        /etc/default/puppet 3.2.3-1 puppet -- "$@"
-fi
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff --git a/debian/puppet.service b/debian/puppet.service
index b41f648..7d3217c 100644
--- a/debian/puppet.service
+++ b/debian/puppet.service
@@ -3,8 +3,9 @@ Description=Puppet agent
 
 [Service]
 Type=forking
+EnvironmentFile=-/etc/default/puppet
 PIDFile=/run/puppet/agent.pid
-ExecStart=/usr/bin/puppet agent
+ExecStart=/usr/bin/puppet agent $DAEMON_OPTS
 
 [Install]
 WantedBy=multi-user.target

Attachment: signature.asc
Description: Digital signature

Reply via email to