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

Please update bcfg2 in squeeze to 1.0.1-3



Hi RMs,

I'd like to have Bcfg2 in squeeze updated to the version currently in unstable
to fix #591030 and to address the fact that the Bcfg2 client no longer
supports agent mode (changes to client init script, defaults file and
NEWS.Debian). The (attached) diff also contains a patch to the manpage
(removing the agent mode options), a tiny correction to the control file and
an update of Standards-Version. The bulk of the patch is a rewrite of the
server init script, which had major issues as discussed in the bugreport.

Changelog is as follows:

  * Rewrote the Bcfg2 server init script to address a long list of issues
    (Closes: #591030)
  * Remove support for agent mode (no longer supported upstream), note
    the removal in debian/NEWS
  * Apply patch from upstream to remove nonexistent agent options from
    the client manpage
  * Update Standards-Version to 3.9.1.0, no changes
  * Use correct package name for SQLAlchemy in Suggests

Let me know if this is ok for an exception.

-- 
Arto Jantunen

diff --git a/debian/NEWS b/debian/NEWS
new file mode 100644
index 0000000..e97ca31
--- /dev/null
+++ b/debian/NEWS
@@ -0,0 +1,7 @@
+bcfg2 (1.0.1-1) unstable; urgency=low
+
+  Since version 1.0, Bcfg2 no longer supports agent mode. Please update your 
+  configuration accordingly if you were using it.
+
+ -- Arto Jantunen <viiru@debian.org>  Tue, 03 Aug 2010 12:28:54 +0300
+
diff --git a/debian/bcfg2-server.init b/debian/bcfg2-server.init
index fad18dc..7047b52 100644
--- a/debian/bcfg2-server.init
+++ b/debian/bcfg2-server.init
@@ -1,112 +1,135 @@
-#!/bin/sh
-#
-# bcfg-server - Bcfg2 configuration daemon
-#
-# chkconfig: 2345 19 81
-# description: bcfg2 server for configuration requests
-#
+#! /bin/sh
 ### BEGIN INIT INFO
 # Provides:          bcfg2-server
-# Required-Start:    $network $remote_fs $named
-# Required-Stop:     $network $remote_fs $named
+# Required-Start:    $network $remote_fs $named $syslog
+# Required-Stop:     $network $remote_fs $named $syslog
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: Configuration management Server
-# Description:       Bcfg2 is a configuration management system that builds
-#                    installs configuration files served by bcfg2-server
+# Description:       The server component of the Bcfg2 configuration management
+#                    system
 ### END INIT INFO
 
-# Include lsb functions
-. /lib/lsb/init-functions
+# Author: Arto Jantunen <viiru@debian.org>
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Configuration management server"
+NAME=bcfg2-server
+DAEMON=/usr/sbin/$NAME
+PIDFILE=/var/run/$NAME.pid
+DAEMON_ARGS="-D $PIDFILE"
+SCRIPTNAME=/etc/init.d/$NAME
 
-# Commonly used stuff
-DAEMON=/usr/sbin/bcfg2-server
-PIDFILE=/var/run/bcfg2-server.pid
-PARAMS="-D $PIDFILE"
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
 
 # Disabled per default
 BCFG2_SERVER_OPTIONS=""
 BCFG2_SERVER_ENABLED=0
 
-# Include default startup configuration if exists
-test -f "/etc/default/bcfg2-server" && . /etc/default/bcfg2-server
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
 
 if [ "$BCFG2_SERVER_ENABLED" -eq 0 ] ; then
      log_failure_msg "bcfg2-server is disabled - see /etc/default/bcfg2-server"
      exit 0
 fi
 
-# Exit if $DAEMON doesn't exist and is not executable
-test -x $DAEMON || exit 5
-
-# Internal variables
-BINARY=$(basename $DAEMON)
-
-start () {
-    echo -n "Starting Configuration Management Server: "
-    start_daemon ${DAEMON} ${PARAMS} ${BCFG2_SERVER_OPTIONS}
-    STATUS=$?
-    if [ "$STATUS" = 0 ]
-    then
-        log_success_msg "bcfg2-server"
-        test -d /var/lock/subsys && touch /var/lock/subsys/bcfg2-server
-    else
-        log_failure_msg "bcfg2-server"
-    fi
-    return $STATUS
-}
-
-stop () {
-    echo -n "Stopping Configuration Management Server: "
-    killproc -p $PIDFILE ${BINARY}
-    STATUS=$?
-    if [ "$STATUS" = 0 ]; then
-      log_success_msg "bcfg2-server"
-      test -d /var/lock/subsys && touch /var/lock/subsys/bcfg2-server
-    else
-      log_failure_msg "bcfg2-server"
-    fi
-    return $STATUS
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+	# Return
+	#   0 if daemon has been started
+	#   1 if daemon was already running
+	#   2 if daemon could not be started
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME \
+	    --startas $DAEMON --test > /dev/null || return 1
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME \
+	    --startas $DAEMON -- $DAEMON_ARGS || return 2
 }
 
-status () {
-    # Inspired by redhat /etc/init.d/functions status() call
-    PID=$(pidof -x $BINARY)
-    if [ -n "$PID" ]; then
-      echo "$BINARY (pid $PID) is running..."
-      return 0
-    fi
-
-    if [ -f $PIDFILE ]; then
-      if [ -n "$PID" ]; then
-        log_failure_msg "$BINARY dead but pid file exists..."
-        return 1
-      fi
-    fi
-
-    log_failure_msg "$BINARY is not running"
-    return 3
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+	# Return
+	#   0 if daemon has been stopped
+	#   1 if daemon was already stopped
+	#   2 if daemon could not be stopped
+	#   other if a failure occurred
+	start-stop-daemon --stop --quiet --retry=TERM/15/KILL/5 --pidfile \
+	    $PIDFILE --name $NAME
+	RETVAL="$?"
+	[ "$RETVAL" = 2 ] && return 2
+	# Many daemons don't delete their pidfiles when they exit.
+	rm -f $PIDFILE
+	return "$RETVAL"
 }
 
 case "$1" in
-    start)
-        start
-    ;;
-    stop)
-        stop
-    ;;
-    status)
-        status
-    ;;
-    restart|reload|force-reload)
-        stop
-        sleep 5
-        start
-    ;;
-    *)
-        log_success_msg "Usage: $0 {start|stop|status|reload|restart|force-reload}"
-        exit 1
-    ;;
+  start)
+	log_daemon_msg "Starting $DESC" "$NAME"
+	do_start
+	case "$?" in
+		0|1) log_end_msg 0 ;;
+		2) log_end_msg 1 ;;
+	esac
+	;;
+  stop)
+	log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) log_end_msg 0 ;;
+		2) log_end_msg 1 ;;
+	esac
+	;;
+  status)
+       start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME \
+       --startas $DAEMON --test > /dev/null 
+       RETVAL="$?"
+       if [ "$RETVAL" = 0 ]; then
+	   echo "$NAME is not running"
+	   exit 3
+       else
+	   echo "$NAME is running"
+	   exit 0
+       fi
+       ;;
+  restart|force-reload)
+	log_daemon_msg "Restarting $DESC" "$NAME"
+	do_stop
+	case "$?" in
+	  0|1)
+		do_start
+		case "$?" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 1 ;; # Old process is still running
+			*) log_end_msg 1 ;; # Failed to start
+		esac
+		;;
+	  *)
+	  	# Failed to stop
+		log_end_msg 1
+		;;
+	esac
+	;;
+  *)
+	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+	exit 3
+	;;
 esac
 
-exit 0
+:
diff --git a/debian/bcfg2.default b/debian/bcfg2.default
index 03ecdfb..8ed0da7 100644
--- a/debian/bcfg2.default
+++ b/debian/bcfg2.default
@@ -20,11 +20,7 @@
 #BCFG2_INIT=1
 
 # BCFG2_AGENT:
-# Run Bcfg2 in Agent mode at system bootup
-#
-# Set value to 1 to enable
-#   Default: 0 (disable)
-#BCFG2_AGENT=1
+# Bcfg2 no longer supports agent mode, please see NEWS.Debian
 
 # BCFG2_CRON:
 # Set the frequency of cron runs.
diff --git a/debian/bcfg2.init b/debian/bcfg2.init
index 76adf0a..add840c 100644
--- a/debian/bcfg2.init
+++ b/debian/bcfg2.init
@@ -38,26 +38,21 @@ test -f "/etc/default/bcfg2" && . /etc/default/bcfg2
 [ "$BCFG2_AGENT" -eq 0  -a "$BCFG2_INIT" -eq 0 ] && exit 0
 
 # Exit if bcfg2 doesn't exist and is not executable
-test -x $BCFG2 || exit 5
+test -x $BCFG2 || exit 0
+
+if [ "$BCFG2_AGENT" != 0 ]; then
+    echo "Bcfg2 no longer supports agent mode, please update your configuration!"
+    exit 1
+fi
 
-# Agent mode daemon capability
-PIDFILE=/var/run/bcfg2-agent.pid
 # Internal variables
 BINARY=$(basename $BCFG2)
 
-AGENT_EXTRA_OPTS="-A -i ${PIDFILE}"
-
 # Include lsb functions
 . /lib/lsb/init-functions
 
 start () {
     echo -n "Running configuration management client: "
-    if [ "$BCFG2_AGENT" -eq 1 ]
-    then
-      start_daemon ${BCFG2} ${AGENT_EXTRA_OPTS} ${BCFG2_OPTIONS} ${BCFG2_OPTIONS_AGENT}
-      STATUS=$?
-    fi
-
     if [ "$BCFG2_INIT" -eq 1 ]; then
       ${BCFG2} ${BCFG2_OPTIONS} ${BCFG2_OPTIONS_INIT}
       STATUS=$?
@@ -66,75 +61,24 @@ start () {
     if [ "$STATUS" -eq 0 ]
     then
       log_success_msg "bcfg2"
-      if [ "$BCFG2_AGENT" -eq 1 ]; then
-          test -d /var/lock/subsys && touch /var/lock/subsys/bcfg2-agent
-      fi
     else
       log_failure_msg "bcfg2"
     fi
     return $STATUS
 }
 
-status () {
-    if [ "$BCFG2_AGENT" -eq 1 ]
-    then
-        PID=$(pidof -x $BINARY)
-        if [ -n "$PID" ] ; then
-            log_success_msg "$BINARY (pid $PID) is running..."
-            return 0
-        fi
-        if [ -f $PIDFILE ]; then
-            if [ -n "$PID" ]; then
-                log_failure_msg "$BINARY dead but pid file exists..."
-                return 1
-            fi
-        fi
-    else
-        return 0
-    fi
-}
-
-stop () {
-    if [ "$BCFG2_AGENT" -eq 1 ]
-    then
-      echo -n "Stopping configuration management client daemon: "
-      killproc -p $PIDFILE ${BINARY}
-      STATUS=$?
-      if [ "$STATUS" -eq 0 ]
-      then
-        log_success_msg "bcfg2"
-        if [ "$BCFG2_AGENT" -eq 1 ]; then
-            test -d /var/lock/subsys && rm -f /var/lock/subsys/bcfg2-agent
-        fi
-      else
-        log_failure_msg "bcfg2"
-      fi
-      return $STATUS
-    else
-      return 0
-    fi
-}
-
 case "$1" in
     start)
         start
     ;;
     stop)
-        stop
-    ;;
-    status)
-        status
+        exit 0
     ;;
-    restart|reload|force-reload)
-        if [ "$BCFG2_AGENT" -eq 1 ]
-        then
-            stop
-            sleep 5
-            start
-        fi
+    restart|force-reload)
+	start
     ;;
   *)
-    echo "Usage: $0 {start|stop|restart|reload|force-reload|status}"
+    echo "Usage: $0 {start|stop|restart|force-reload}"
     exit 1
 esac
 
diff --git a/debian/changelog b/debian/changelog
index 99292b0..9def022 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+bcfg2 (1.0.1-3) unstable; urgency=medium
+
+  [ Arto Jantunen ]
+  * Rewrote the Bcfg2 server init script to address a long list of issues
+    (Closes: #591030)
+  * Remove support for agent mode (no longer supported upstream), note
+    the removal in debian/NEWS
+  * Apply patch from upstream to remove nonexistent agent options from
+    the client manpage
+  * Update Standards-Version to 3.9.1.0, no changes
+  * Use correct package name for SQLAlchemy in Suggests
+
+ -- Arto Jantunen <viiru@debian.org>  Tue, 10 Aug 2010 17:59:44 +0300
+
 bcfg2 (1.0.1-2) unstable; urgency=medium
 
   [ Arto Jantunen ]
diff --git a/debian/control b/debian/control
index 0773323..b2efa50 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Arto Jantunen <viiru@debian.org>
 Uploaders: Sami Haahtinen <ressu@debian.org>
 Build-Depends: debhelper (>= 7.4.2), python (>= 2.6) | python2.6, python-support (>= 1.0.9)
-Standards-Version: 3.9.0.0
+Standards-Version: 3.9.1.0
 Homepage: http://bcfg2.org/
 
 Package: bcfg2
@@ -20,7 +20,7 @@ Package: bcfg2-server
 Architecture: all
 Depends: ${python:Depends}, ${misc:Depends}, python-lxml (>= 0.9), libxml2-utils (>= 2.6.23), lsb-base (>= 3.1-9), ucf, bcfg2 (= ${binary:Version}), openssl, fam | gamin, python-fam | python-gamin, fam | python-gamin, gamin | python-fam
 Recommends: graphviz
-Suggests: python-cheetah, python-genshi (>= 0.4.4), python-profiler, sqlalchemy (>= 0.5.0), python-django, mail-transport-agent
+Suggests: python-cheetah, python-genshi (>= 0.4.4), python-profiler, python-sqlalchemy (>= 0.5.0), python-django, mail-transport-agent
 Description: Configuration management server
  Bcfg2 is a configuration management system that generates configuration sets
  for clients bound by client profiles.
diff --git a/debian/patches/0003-agent-in-manpage.patch b/debian/patches/0003-agent-in-manpage.patch
new file mode 100644
index 0000000..43c18b6
--- /dev/null
+++ b/debian/patches/0003-agent-in-manpage.patch
@@ -0,0 +1,35 @@
+Author: Sol Jerome <solj@ices.utexas.edu>
+Subject: man: Remove nonexistent agent options (Reported by Jonathan Billings)
+Origin: upstream, https://trac.mcs.anl.gov/projects/bcfg2/changeset/5860
+
+diff --git a/man/bcfg2.1 b/man/bcfg2.1
+index 43f0a49..a2ea07b 100644
+--- a/man/bcfg2.1
++++ b/man/bcfg2.1
+@@ -16,10 +16,6 @@ finally uploading statistics about the bcfg2 execution and client
+ state.
+ .SH OPTIONS
+ .TP
+-.BR "\-A" 
+-Run in agent (continuous) mode, wait for reconfigure command from
+-server.
+-.TP
+ .BR "\-C <configfile>"
+ Specify alternate bcfg2.conf location
+ .TP
+@@ -72,15 +68,9 @@ verbosity rework)
+ .BR "\-f <specification path>" 
+ Configure from a file rather than querying the server.
+ .TP 
+-.BR "\-g <agent port>" 
+-Allows you to specify which port to bind.
+-.TP 
+ .BR "\-h" 
+ Print Usage information.
+ .TP 
+-.BR "\-i" 
+-Daemonize the agent.
+-.TP 
+ .BR "\-k" 
+ Run in bulletproof mode. This currently only effect behavior in the
+ debian toolset; it calls apt-get update and clean and dpkg --configure --pending.
diff --git a/debian/patches/series b/debian/patches/series
index 914407e..24b6e31 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-new-debsums.patch
 0002-apt-deprecation-warnings.patch
+0003-agent-in-manpage.patch

Reply to: