launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #16001
[Merge] lp:~smoser/maas/packaging.1231693-2 into lp:~maas-maintainers/maas/packaging
Scott Moser has proposed merging lp:~smoser/maas/packaging.1231693-2 into lp:~maas-maintainers/maas/packaging.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1231693 in MAAS: "maas-dhcp backport does not start on precise"
https://bugs.launchpad.net/maas/+bug/1231693
For more details, see:
https://code.launchpad.net/~smoser/maas/packaging.1231693-2/+merge/188967
One of these 2 branches can be chosen. Either
a.
https://code.launchpad.net/~smoser/maas/packaging.1231693-2/+merge/188967
or
https://code.launchpad.net/~smoser/maas/packaging.1231693/+merge/188932
I'm really OK with either. One is more complex but supports more scenarios (this one)
the other is a simpler upstart job that only supports one version of isc-dhcp (quantal-saucy version).
--
https://code.launchpad.net/~smoser/maas/packaging.1231693-2/+merge/188967
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~smoser/maas/packaging.1231693-2 into lp:~maas-maintainers/maas/packaging.
=== modified file 'debian/control'
--- debian/control 2013-10-02 19:37:31 +0000
+++ debian/control 2013-10-03 00:44:27 +0000
@@ -249,7 +249,7 @@
Package: maas-dhcp
Architecture: all
-Depends: isc-dhcp-server, ${misc:Depends}
+Depends: isc-dhcp-server (>= 4.2.4), ${misc:Depends}
Breaks: maas-dhcp (<= 0.1+bzr777+dfsg-0ubuntu1)
Replaces: maas-dhcp (<= 0.1+bzr777+dfsg-0ubuntu1)
Description: Ubuntu MAAS Server - DHCP Configuration (meta-package)
=== modified file 'debian/maas-dhcp.maas-dhcp-server.upstart'
--- debian/maas-dhcp.maas-dhcp-server.upstart 2013-05-21 13:17:57 +0000
+++ debian/maas-dhcp.maas-dhcp-server.upstart 2013-10-03 00:44:27 +0000
@@ -5,9 +5,7 @@
stop on runlevel [!2345]
env CONFIG_FILE=/etc/maas/dhcpd.conf
-env PID_DIR=/run/maas/dhcp
env PID_FILE=/run/maas/dhcp/dhcpd.pid
-env LEASES_DIR=/var/lib/maas/dhcp
env LEASES_FILE=/var/lib/maas/dhcp/dhcpd.leases
# This is where we write what interfaces dhcpd should listen on.
@@ -37,32 +35,64 @@
respawn
script
- RELEASE=`lsb_release --codename --short`
+ dhcpd_bugmode() {
+ # bug 1231988 and bug 1231693 have more information.
+ # return one of 'precise', or 'quantal'
+ # indicating if isc-dhcp behaves like it did on precise,
+ # like on quantal (through saucy at least)
+
+ local dver=""
+ # first figure out what the version is
+ dver=$(dpkg-query --showformat '${Version}\n' \
+ --show isc-dhcp-server 2>/dev/null) || :
+ if [ -z "$dver" ]; then
+ # dpkg query failed. try --version
+ dver=$(dhcpd --version 2>&1) && dver=${dver#isc-dhcpd-} &&
+ [ "${dver#[456]}" != "${dver}" ] || dver=""
+ fi
+
+ if [ -z "$dver" ]; then
+ echo "FAIL: could not get dhcpd version!"
+ exit 1
+ fi
+
+ # precise shipped 4.1, quantal shipped 4.2.4
+ if dpkg --compare-versions "$dver" lt 4.2.4; then
+ BUGMODE="precise"
+ else
+ BUGMODE="quantal"
+ fi
+ }
+
INTERFACES=`cat "${INTERFACES_FILE}"`
- # Allow dhcp server to write lease and pid file.
- mkdir -p $PID_DIR
- chown dhcpd:dhcpd $PID_DIR
-
- # As of Quantal, the leases file must be owned by root:root (even though
- # the daemon will run under an unprivileged user).
- # In Precise, ownership was supposed to be dhcpd:dhcpd.
- mkdir -p $LEASES_DIR
- if [ "$RELEASE" = "precise" ]; then
- owner_group="dhcpd:dhcpd"
- dhcpd_owner_opts=""
+ PID_D=${PID_FILE%/*}
+ LEASES_D=${LEASES_FILE%/*}
+
+ # we operate on leases~ only if it exists
+ LEASES_TILDA="${LEASES_FILE}~"
+ [ -e "$LEASES_TILDA" ] || LEASES_TILDA=""
+
+ mkdir -p $PID_D $LEASES_D
+ chown dhcpd:dhcpd $PID_D
+
+ touch $LEASES_FILE
+
+ dhcpd_bugmode
+ if [ "$BUGMODE" = "precise" ]; then
+ # the daemon runs as dhcpd even without -user and -group opts
+ chown dhcpd:dhcpd $LEASES_D $LEASES_TILDA $LEASES_FILE
+ USER_GROUP_OPTS=""
+ elif [ "$BUGMODE" = "quantal" ]; then
+ # bug 1231988 is present
+ chown root:root $LEASES_D $LEASES_TILDA $LEASES_FILE
+ USER_GROUP_OPTS="-u dhcpd -g dhcpd"
else
- owner_group="root:root"
- dhcpd_owner_opts="-user dhcpd -group dhcpd"
+ echo "FAIL: unknown dhcpd_bugmode '$BUGMODE'"
+ exit 1
fi
- chown $owner_group $LEASES_DIR
- [ -e $LEASES_FILE ] || touch $LEASES_FILE
- for LFILE in $LEASES_FILE $LEASES_FILE~; do
- if [ -e $LFILE ]; then
- chown $owner_group $LFILE
- chmod a+r $LFILE
- fi
- done
-
- exec /usr/sbin/dhcpd ${dhcpd_owner_opts} -f -q -4 -pf $PID_FILE -cf $CONFIG_FILE -lf $LEASES_FILE $INTERFACES
+
+ exec /usr/sbin/dhcpd $USER_GROUP_OPTS -f -q -4 -pf $PID_FILE \
+ -cf $CONFIG_FILE -lf $LEASES_FILE $INTERFACES
+
end script
References