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

Bug#771929: (pre-approved) unblock: openstack-pkg-tools/20



On 12/12/2014 05:40 AM, Jonathan Wiltshire wrote:
> The attached proposal seems reasonable. Please remove the moreinfo tag when
> you need some action from us.

Hi there!

It took me a little longer than expected to have it right: the previous
debdiff wasn't full correct, I believe it is now. I had issues figuring
out what was happening with the dh_systemd_enable call, but I finally
understood. Since openstack-pkg-tools generates the .service *after* the
normal sequence of dh_systemd_enable, then the postinst for the
corresponding packages was wrong. Which is why this last debdiff
includes the additional dh_systemd_enable call.

I have checked for the result of the changes for systemd support, and as
much as I can tell, the attached debdiff is fixing the issues. So I
uploaded version 20.

Please unblock openstack-pkg-tools/20.

I'll upload rebuilt packages for all packages using the daemon feature
of openstack-pkg-tools once version 20 gets in Jessie.

Cheers,

Thomas Goirand (zigo)

diff -Nru openstack-pkg-tools-19/debian/changelog openstack-pkg-tools-20/debian/changelog
--- openstack-pkg-tools-19/debian/changelog	2014-11-10 17:29:43.000000000 +0000
+++ openstack-pkg-tools-20/debian/changelog	2014-12-14 07:57:40.000000000 +0000
@@ -1,3 +1,13 @@
+openstack-pkg-tools (20) unstable; urgency=medium
+
+  * Now using a forking daemon anymore when using systemd. Thanks to Mikaël
+    Cluseau <mcluseau@isi.nc> for working on this cool feature. This also fixes
+    the issue that /var/run/$PROJECT_NAME was not created at boot time, and
+    then the daemon were not started.
+  * Calling dh_systemd_enable correctly when a .service file is generated.
+
+ -- Thomas Goirand <zigo@debian.org>  Fri, 12 Dec 2014 15:24:43 +0000
+
 openstack-pkg-tools (19) unstable; urgency=medium
 
   * Using RuntimeDirectory=${PROJECT_NAME} as per advice in #debian-systemd.
diff -Nru openstack-pkg-tools-19/init-template/init-script-template openstack-pkg-tools-20/init-template/init-script-template
--- openstack-pkg-tools-19/init-template/init-script-template	2014-11-10 17:29:43.000000000 +0000
+++ openstack-pkg-tools-20/init-template/init-script-template	2014-12-14 07:57:40.000000000 +0000
@@ -36,11 +36,13 @@
 # Exit if the package is not installed
 [ -x $DAEMON ] || exit 0
 
-# Create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X
-for i in lock run log lib ; do
-	mkdir -p /var/$i/${PROJECT_NAME}
-	chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME}
-done
+# If ran as root, create /var/lock/X, /var/run/X, /var/lib/X and /var/log/X
+if [ "x$USER" = "xroot" ] ; then
+	for i in lock run log lib ; do
+		mkdir -p /var/$i/${PROJECT_NAME}
+		chown ${SYSTEM_USER} /var/$i/${PROJECT_NAME}
+	done
+fi
 
 # This defines init_is_upstart which we use later on (+ more...)
 . /lib/lsb/init-functions
@@ -65,6 +67,10 @@
 	return "$RETVAL"
 }
 
+do_systemd_start() {
+	exec $DAEMON $DAEMON_ARGS
+}
+
 case "$1" in
 start)
 	init_is_upstart > /dev/null 2>&1 && exit 1
@@ -88,11 +94,8 @@
 	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
 ;;
 systemd-start)
-	do_start
+	do_systemd_start
 ;;  
-systemd-stop)
-	do_stop
-;;
 restart|force-reload)
 	init_is_upstart > /dev/null 2>&1 && exit 1
 	log_daemon_msg "Restarting $DESC" "$NAME"
@@ -110,7 +113,7 @@
 	esac
 ;;
 *)
-	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start|systemd-stop}" >&2
+	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|systemd-start}" >&2
 	exit 3
 ;;
 esac
diff -Nru openstack-pkg-tools-19/init-template/pkgos-gen-systemd-unit openstack-pkg-tools-20/init-template/pkgos-gen-systemd-unit
--- openstack-pkg-tools-19/init-template/pkgos-gen-systemd-unit	2014-11-10 17:29:43.000000000 +0000
+++ openstack-pkg-tools-20/init-template/pkgos-gen-systemd-unit	2014-12-14 07:57:40.000000000 +0000
@@ -12,7 +12,7 @@
 if [ -z "${SYSTEM_USER}" ] ; then
 	SYSTEM_USER=${PROJECT_NAME}
 fi
-if [ -z "${SYSTEM_USER}" ] ; then
+if [ -z "${SYSTEM_GROUP}" ] ; then
 	SYSTEM_GROUP=${PROJECT_NAME}
 fi
 
@@ -33,12 +33,12 @@
 [Service]
 User=${SYSTEM_USER}
 Group=${SYSTEM_GROUP}
+WorkingDirectory=/var/lib/${PROJECT_NAME}
+PermissionsStartOnly=true
+ExecStartPre=/bin/mkdir -p /var/lock/${PROJECT_NAME} /var/log/${PROJECT_NAME} /var/lib/${PROJECT_NAME}
+ExecStartPre=/bin/chown ${SYSTEM_USER}:${SYSTEM_GROUP} /var/lock/${PROJECT_NAME} /var/log/${PROJECT_NAME} /var/lib/${PROJECT_NAME}
 ExecStart=${SCRIPTNAME} systemd-start
-ExecStop=${SCRIPTNAME} systemd-stop
-RuntimeDirectory=${PROJECT_NAME}
-PIDFile=/var/run/${PROJECT_NAME}/${NAME}.pid
 Restart=on-failure
-Type=forking
 
 [Install]
 WantedBy=multi-user.target
diff -Nru openstack-pkg-tools-19/pkgos.make openstack-pkg-tools-20/pkgos.make
--- openstack-pkg-tools-19/pkgos.make	2014-11-10 17:29:43.000000000 +0000
+++ openstack-pkg-tools-20/pkgos.make	2014-12-14 07:57:40.000000000 +0000
@@ -36,8 +36,14 @@
 	done
 	dh_installinit --error-handler=true
 	# Generate the systemd unit file
+	# Note: because dh_systemd_enable is called by the
+	# dh sequencer *before* dh_installinit, we have
+	# to process it manually.
 	for i in `ls debian/*.init.in` ; do \
 		pkgos-gen-systemd-unit $$i ; \
+		MYSERVICE=`echo $$i | sed 's/debian\///'` ; \
+		MYSERVICE=`echo $$MYSERVICE | sed 's/.init.in/.service/'` ; \
+		dh_systemd_enable $$MYSERVICE ; \
 	done
 
 gen-author-list:

Reply to: