fix pid writing in slave xlock.
authorMartin Pihlak <martin.pihlak@gmail.com>
Thu, 24 Mar 2011 11:01:06 +0000 (13:01 +0200)
committerMartin Pihlak <martin.pihlak@gmail.com>
Thu, 24 Mar 2011 11:01:06 +0000 (13:01 +0200)
Slave xlock should not attempt to write pid to BACKUPLOCK
if none was specified on command line.

python/walmgr.py

index 94f2b0e026217981eca6d3c73345d2ebaa6a0e6f..a7ea189c9d7fc50675426027373ff6026def0d9e 100755 (executable)
@@ -1966,7 +1966,10 @@ STOP TIME: %(stop_time)s
             return 1
 
         if not self.not_really:
-            open(lockfile, "w").write(self.args[0])
+            f = open(lockfile, "w")
+            if len(self.args) > 0:
+                f.write(self.args[0])
+            f.close()
         self.log.info("Backup lock obtained.")
         return 0