diff mbox series

[ovs-dev,1/1] debian: Do not modify pre-existing defaults file

Message ID CAPKm8QAwVS8ZuXjDJcvVL-AGBkiEa=NWDGPdgV1hK40d-3CXQw@mail.gmail.com
State Accepted
Headers show
Series [ovs-dev,1/1] debian: Do not modify pre-existing defaults file | expand

Commit Message

Frode Nordahl Oct. 17, 2017, 2:29 p.m. UTC
Currently, on installation or upgrade the openvswitch-switch deb package
will in some circumstances modify a pre-existing
/etc/default/openvswitch-switch configuration file.

This does not play well with modeling and configuration management tools
and may lead to unnecessary restarts of the openvswitch-switch service
after the initial restart done as part of the package upgrade. As
restarting the openvswitch-switch affects the datapath this is
something we should try to avoid.

I also believe the current behaviour to be in conflict with best practices
set out in the config files section of the
[Debian Policy](https://www.debian.org/doc/debian-policy/#s-config-files).

This commit addresses this by removing the part of the postinst script
that attempts to append missing documentation parts of the template
and leaves the installed defaults file alone when it exists.

Signed-off-by: Frode Nordahl <frode.nordahl@gmail.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/137
---
         # are forks) may install upstart files which are incompatible

Comments

Ben Pfaff Feb. 1, 2018, 9:48 p.m. UTC | #1
On Tue, Oct 17, 2017 at 04:29:40PM +0200, Frode Nordahl wrote:
> Currently, on installation or upgrade the openvswitch-switch deb package
> will in some circumstances modify a pre-existing
> /etc/default/openvswitch-switch configuration file.
> 
> This does not play well with modeling and configuration management tools
> and may lead to unnecessary restarts of the openvswitch-switch service
> after the initial restart done as part of the package upgrade. As
> restarting the openvswitch-switch affects the datapath this is
> something we should try to avoid.
> 
> I also believe the current behaviour to be in conflict with best practices
> set out in the config files section of the
> [Debian Policy](https://www.debian.org/doc/debian-policy/#s-config-files).
> 
> This commit addresses this by removing the part of the postinst script
> that attempts to append missing documentation parts of the template
> and leaves the installed defaults file alone when it exists.
> 
> Signed-off-by: Frode Nordahl <frode.nordahl@gmail.com>
> Reported-at: https://github.com/openvswitch/ovs-issues/issues/137

Thanks, this code was added in 2009 with the following commit.  It's
clearly past its "sell-by" date, so I applied your patch to OVS master.

commit 0aaa379d99f4fb48eb34b1ea5858b0954a5f8c8d
Author: Ben Pfaff <blp@nicira.com>
Date:   Tue Jan 20 13:33:44 2009 -0800

    Debian packaging: Add several new settings to /etc/default/openflow-switch.
diff mbox series

Patch

diff --git a/debian/changelog b/debian/changelog
index d2b244fca..f1a0e0c77 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@ 
 openvswitch (2.8.90-1) unstable; urgency=medium

-   - Nothing yet!  Try NEWS...
+   [ Open vSwitch team ]
+   * Do not modify pre-existing /etc/default/openvswitch-switch

  -- Open vSwitch team <dev@openvswitch.org>  Fri, 04 Aug 2017 15:00:00
-0700

diff --git a/debian/openvswitch-switch.postinst
b/debian/openvswitch-switch.postinst
index 3f9b0553f..f8abd40e2 100755
--- a/debian/openvswitch-switch.postinst
+++ b/debian/openvswitch-switch.postinst
@@ -24,14 +24,6 @@  case "$1" in
         TEMPLATE=/usr/share/openvswitch/switch/default.template
         if ! test -e $DEFAULT; then
             cp $TEMPLATE $DEFAULT
-        else
-                for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}'
$TEMPLATE)
-                do
-                    if ! grep $var $DEFAULT >/dev/null 2>&1; then
-                        echo >> $DEFAULT
-                        sed -n "/$var:/,/$var=/p" $TEMPLATE >> $DEFAULT
-                    fi
-                done
         fi
         # Certain versions of upstream Ubuntu's openvswitch packages (which