[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.50-20-gdf38a79

Andreas Beckmann anbe at debian.org
Wed Mar 20 22:04:02 UTC 2013


The following commit has been merged in the develop branch:
commit 20083cee3d6f79cdee2ff267652e939cbd29df92
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Mar 17 09:30:00 2013 +0100

    p-s/p-m: move chdir and stderr logging to master wrapper
    
    no longer use a section specific error log to prepare for
    implementing a "section" command in the master-slave protocol
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/README.txt b/README.txt
index 99562e7..b7d060b 100644
--- a/README.txt
+++ b/README.txt
@@ -540,6 +540,9 @@ section, too, and will serve as defaults for all other sections
 * "log-file" is the name of a file to where the master should write
  its log messages. In the default configuration file it is
  "$SECTION/master.log". To disable logging, set it to "/dev/null".
+ The global "log-file" setting (defaulting to master-error.log) is
+ used for logging stderr output from piuparts-master. This logfile
+ will be placed in the 'master-directory' and has the PID appended.
 
 * "piuparts-command" is the command the slave uses to start
  piuparts. It should include 'sudo' if necessary so that piuparts
diff --git a/debian/changelog b/debian/changelog
index e769dac..8e01c02 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,8 +8,12 @@ piuparts (0.51) UNRELEASED; urgency=low
   * Rename piuparts-master.py to piuparts-master-backend.py
   * piuparts-master: New.
     - Wrapper shell script to simplify calling the master from the slave.
+    - Get the 'master-directory' from piuparts.conf and chdir there.
+    - Get the (global) 'log-file' from piuparts.conf and handle the error
+      logging. No longer uses the section specific logfile name for errors.
   * piuparts-master-backend.py:
   * piuparts-slave.py:
+    - Let the piuparts-master (wrapper script) handle chdir and error logging.
   * piuparts-analyze.py:
   * piuparts-report.py:
   * Makefile:
diff --git a/piuparts-master.in b/piuparts-master.in
index 358ed18..8664529 100755
--- a/piuparts-master.in
+++ b/piuparts-master.in
@@ -25,10 +25,15 @@ set -e
 
 . @sharedir@/piuparts/lib/read_config.sh
 
+get_config_value MASTER global master-directory
 get_config_value PYTHONPATH global PYTHONPATH ''
+get_config_value LOGFILE global log-file master-error.log
 
 
 export PYTHONPATH
+LOGFILE="$LOGFILE.$$"
+
+cd "$MASTER"
 
 section="$1"
 if [ -z "$section" ]; then
@@ -36,4 +41,6 @@ if [ -z "$section" ]; then
 	exit 1
 fi
 
- at sharedir@/piuparts/piuparts-master-backend "$section"
+trap "test -s ${LOGFILE} || rm -f ${LOGFILE}" EXIT
+
+ at sharedir@/piuparts/piuparts-master-backend "$section" 2> "$LOGFILE"
diff --git a/piuparts-slave.py b/piuparts-slave.py
index e759295..ee792a8 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -206,10 +206,8 @@ class Slave:
         if self._master_user:
             ssh_command.extend(["-l", self._master_user])
         ssh_command.append(self._master_host)
-        ssh_cmdline = "cd %s; %s %s 2> %s.$$ && rm %s.$$" % \
-                      (self._master_directory or ".",
-                      self._master_command, self._section, log_file, log_file)
-        ssh_command.append(ssh_cmdline)
+        ssh_command.append(self._master_command)
+        ssh_command.append(self._section)
         p = subprocess.Popen(ssh_command, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
         self._to_master = p.stdin
         self._from_master = p.stdout

-- 
piuparts git repository



More information about the Piuparts-commits mailing list