[Piuparts-commits] [piuparts] 01/01: slave_run: minor bugfix for using arguments instead of configuration.

Holger Levsen holger at layer-acht.org
Mon Feb 20 15:33:53 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit d6d6eb126ae9e0cd186c47c96e40c8890eb2e81b
Author: Holger Levsen <holger at layer-acht.org>
Date:   Mon Feb 20 16:33:26 2017 +0100

    slave_run: minor bugfix for using arguments instead of configuration.
    
    Fix bug which prevented a different number of slaves to be started than
    defined in the configuration. Also add a check to ensure that this optional
    argument is an integer and within the defined maximum number of slaves.
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog       | 4 ++++
 slave-bin/slave_run.in | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b70a94d..c88d7e1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,10 @@ piuparts (0.76) UNRELEASED; urgency=medium
   * Update README_pejacevic.txt.
   * Update (the unused example) piuparts.conf.piu-slave-1und1-01 to match
     piuparts.conf.piu-slave-bm-a except for arch and mirror.
+  * slave_run: Fix bug which prevented a different number of slaves to be
+    started than defined in the configuration. Also add a check to ensure that
+    this optional argument is an integer and within the defined maximum number
+    of slaves.
 
  -- Andreas Beckmann <anbe at debian.org>  Mon, 06 Feb 2017 01:11:27 +0100
 
diff --git a/slave-bin/slave_run.in b/slave-bin/slave_run.in
index 43c23cd..9163aec 100755
--- a/slave-bin/slave_run.in
+++ b/slave-bin/slave_run.in
@@ -59,9 +59,9 @@ screen -S $SESSIONNAME -d -m
 echo "Started screen session '$SESSIONNAME'."
 
 # run this on a single slave or a sequence of slaves
-# FIXME: this should really test whether $1 is an integer and within SLAVECOUNT
-if [ "$1" != "" ] ; then
-	SLAVES=$1
+# (use value given, if given and an integer and <= $SLAVECOUNT)
+if [ "$1" != "" ] && [ "$1" -eq "$1" ] && [ "$1" -le "$SLAVECOUNT" ] ; then
+	SLAVES="$(seq $1)"
 else
 	SLAVES="$(seq $SLAVECOUNT)"
 fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list