pld-builder.new: PLD_Builder/file_sender.py use env var for specifying rsyn...
glen
glen at pld-linux.org
Mon Nov 28 11:02:10 CET 2011
Author: glen Date: Mon Nov 28 10:02:10 2011 GMT
Module: pld-builder.new Tag: HEAD
---- Log message:
use env var for specifying rsync password
---- Files affected:
pld-builder.new/PLD_Builder:
file_sender.py (1.40 -> 1.41)
---- Diffs:
================================================================
Index: pld-builder.new/PLD_Builder/file_sender.py
diff -u pld-builder.new/PLD_Builder/file_sender.py:1.40 pld-builder.new/PLD_Builder/file_sender.py:1.41
--- pld-builder.new/PLD_Builder/file_sender.py:1.40 Sat Oct 1 20:54:51 2011
+++ pld-builder.new/PLD_Builder/file_sender.py Mon Nov 28 11:02:05 2011
@@ -57,27 +57,26 @@
def rsync_file(src, target, host):
global problems
+
p = open(path.rsync_password_file, "r")
- password = None
+ password = ""
for l in p.xreadlines():
l = string.split(l)
if len(l) >= 2 and l[0] == host:
password = l[1]
p.close()
+
+ # NOTE: directing STDIN to /dev/null, does not make rsync to skip asking
+ # password, it opens /dev/tty and still asks if password is needed and
+ # missing, therefore we always set RSYNC_PASSWORD env var
+ os.environ["RSYNC_PASSWORD"] = password
rsync = "rsync --verbose --archive"
- if password != None:
- p = open(".rsync.pass", "w")
- os.chmod(".rsync.pass", 0600)
- p.write("%s\n" % password)
- p.close()
- rsync += " --password-file .rsync.pass"
- f = os.popen("%s %s %s 2>&1 < /dev/null" % (rsync, src, target))
+ f = os.popen("%s %s %s 2>&1" % (rsync, src, target))
p = f.read()
- if password != None:
- os.unlink(".rsync.pass")
ret = f.close()
if ret:
problems[src] = p
+ del os.environ["RSYNC_PASSWORD"];
return ret
def rsync_ssh_file(src, target):
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-builder.new/PLD_Builder/file_sender.py?r1=1.40&r2=1.41&f=u
More information about the pld-cvs-commit
mailing list