|
From: <di...@us...> - 2010-11-21 20:10:18
|
Revision: 709
http://safekeep.svn.sourceforge.net/safekeep/?rev=709&view=rev
Author: dimi
Date: 2010-11-21 20:10:12 +0000 (Sun, 21 Nov 2010)
Log Message:
-----------
Fix the fallback for the subprocess module, use it when available
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-21 20:01:20 UTC (rev 708)
+++ safekeep/trunk/safekeep 2010-11-21 20:10:12 UTC (rev 709)
@@ -24,9 +24,11 @@
try:
import subprocess
from subprocess import PIPE, STDOUT
+ use_subprocess = True
except:
PIPE = -1
STDOUT = -2
+ use_subprocess = False
######################################################################
# Global settings
@@ -128,16 +130,13 @@
else:
_stderr = STDOUT
- if 'subprocess' in dir():
+ if use_subprocess:
proc = subprocess.Popen(args, bufsize=1, shell=_shell, stdin=_stdin, stdout=PIPE, stderr=_stderr, close_fds=True)
child_in = proc.stdin
child_out = proc.stdout
- def do_wait():
- return proc_wait()
-
else:
if _shell:
- args = ["/bin/sh", "-c"].extend(args)
+ args = ["/bin/sh", "-c", args]
if _stderr:
(child_in, child_out) = os.popen4(args)
else:
@@ -146,9 +145,6 @@
if not stdin:
child_in.close()
- def do_wait():
- return 0
-
if stdin:
child_in.write(stdin)
child_in.close()
@@ -160,8 +156,13 @@
else:
info(line.rstrip())
child_out.close()
- return (do_wait(), ''.join(lines))
+ if use_subprocess:
+ return (proc.wait(), ''.join(lines))
+ else:
+ return (0, ''.join(lines))
+
+
def _spawn(args, stdin=None, stdout=False):
if isinstance(args, types.StringTypes):
cmd = args.split(None)[0]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-22 02:03:25
|
Revision: 710
http://safekeep.svn.sourceforge.net/safekeep/?rev=710&view=rev
Author: dimi
Date: 2010-11-22 02:03:19 +0000 (Mon, 22 Nov 2010)
Log Message:
-----------
Add back the Python 2.2 compatibilty hacks
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-21 20:10:12 UTC (rev 709)
+++ safekeep/trunk/safekeep 2010-11-22 02:03:19 UTC (rev 710)
@@ -31,6 +31,24 @@
use_subprocess = False
######################################################################
+# Python 2.2 compatibility
+######################################################################
+# There is no guarantee that we'll continue supporting Python 2.2
+# indefinitely, but we make a reasonable effor to do so as long as
+# it doesn't result in major complication/ugliness.
+
+try:
+ True, False
+except NameError:
+ True, False = 1, 0
+
+def enumerate(obj):
+ i = -1
+ for item in obj:
+ i += 1
+ yield i, item
+
+######################################################################
# Global settings
######################################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-22 20:47:18
|
Revision: 718
http://safekeep.svn.sourceforge.net/safekeep/?rev=718&view=rev
Author: dimi
Date: 2010-11-22 20:47:12 +0000 (Mon, 22 Nov 2010)
Log Message:
-----------
Silly fixes
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-22 19:33:29 UTC (rev 717)
+++ safekeep/trunk/safekeep 2010-11-22 20:47:12 UTC (rev 718)
@@ -130,7 +130,7 @@
def warn(msg):
log(msg, 'WARN')
-def error(msg, ex):
+def error(msg, ex=None):
extra = ""
if ex:
extra = stacktrace()
@@ -873,7 +873,7 @@
do_client_cleanup(cfg, bdir)
if ex:
- send('TRACEBACK ' + ex + '>>>' + stacktrace().replace('\n', '###'))
+ send('TRACEBACK ' + str(ex) + '>>>' + stacktrace().replace('\n', '###'))
######################################################################
# Server implementation
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-23 01:39:03
|
Revision: 720
http://safekeep.svn.sourceforge.net/safekeep/?rev=720&view=rev
Author: dimi
Date: 2010-11-23 01:38:57 +0000 (Tue, 23 Nov 2010)
Log Message:
-----------
Proper reporting of client stacktraces to the server.
Fix the invocation of ssh(1) when we don't have verosity enabled.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-23 01:00:17 UTC (rev 719)
+++ safekeep/trunk/safekeep 2010-11-23 01:38:57 UTC (rev 720)
@@ -75,6 +75,14 @@
# Miscellaneous support functions
######################################################################
+class ClientException(Exception):
+ def __init__(self, value, traceback=None):
+ self.value = value
+ self.traceback = traceback
+
+ def __str__(self):
+ return repr(self.value)
+
def send(msg):
print msg.encode('utf-8')
sys.stdout.flush()
@@ -885,11 +893,10 @@
if line.startswith('OK'):
return line[2:-1].strip()
elif line.startswith('ERROR'):
- raise Exception(line[5:].strip())
+ raise ClientException(line[5:].strip())
elif line.startswith('TRACEBACK'):
i = line.find('>>>')
- error(line[i+3:].replace('###', '\n'))
- raise Exception(line[10:i].strip())
+ raise ClientException(line[10:i].strip(), line[i+3:].replace('###', '\n'))
elif not line:
raise Exception('client died unexpectedly')
else:
@@ -1035,7 +1042,9 @@
cmd = []
if cfg['host']:
- cmd.extend(['ssh', verbosity_ssh, '-T', '-i', cfg['key_ctrl'], '-l', cfg['user'], cfg['host']])
+ cmd.extend(['ssh'])
+ if verbosity_ssh: cmd.extend([verbosity_ssh])
+ cmd.extend(['-T', '-i', cfg['key_ctrl'], '-l', cfg['user'], cfg['host']])
cmd.extend(['safekeep', '--client'])
(cin,cout) = os.popen2(cmd)
@@ -1102,7 +1111,11 @@
info('Client-side cleanup for client %s: FAILED' % id)
do_server_rdiff_cleanup(cfg)
else:
- error('Server backup for client %s: FAILED' % id, ex)
+ if isinstance(ex, ClientException):
+ error('Client %s: FAILED due to: %s' % (id, ex or ''))
+ if ex.traceback: error(ex.traceback)
+ else:
+ error('Server backup for client %s: FAILED' % id, ex)
info('------------------------------------------------------------------')
debug('Server backup done')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-23 04:02:04
|
Revision: 722
http://safekeep.svn.sourceforge.net/safekeep/?rev=722&view=rev
Author: dimi
Date: 2010-11-23 04:01:58 +0000 (Tue, 23 Nov 2010)
Log Message:
-----------
Better identify the client's message class
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-23 03:56:43 UTC (rev 721)
+++ safekeep/trunk/safekeep 2010-11-23 04:01:58 UTC (rev 722)
@@ -94,7 +94,7 @@
msg = '%s: %s' % (cls, msg)
else:
for c in VEBOSITY_BY_CLASS.keys():
- if msg.startswith(c + ': '):
+ if msg.upper().startswith(c + ': '):
cls = c
break
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-23 04:12:58
|
Revision: 724
http://safekeep.svn.sourceforge.net/safekeep/?rev=724&view=rev
Author: dimi
Date: 2010-11-23 04:12:51 +0000 (Tue, 23 Nov 2010)
Log Message:
-----------
New version
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-23 04:11:04 UTC (rev 723)
+++ safekeep/trunk/safekeep 2010-11-23 04:12:51 UTC (rev 724)
@@ -68,7 +68,7 @@
cmd = "<Missing>"
PROTOCOL = "1.1"
-VERSION = "1.3.0"
+VERSION = "1.3.1"
VEBOSITY_BY_CLASS = {'DBG': 3, 'INFO': 2, 'WARN': 1, 'ERR': 0}
######################################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-29 04:17:00
|
Revision: 729
http://safekeep.svn.sourceforge.net/safekeep/?rev=729&view=rev
Author: dimi
Date: 2010-11-29 04:16:54 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
ionice is not necessarily an integer
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-29 04:15:41 UTC (rev 728)
+++ safekeep/trunk/safekeep 2010-11-29 04:16:54 UTC (rev 729)
@@ -1491,7 +1491,7 @@
if nice_def is None: nice_def = 10
nice_srv = get_int('nice.adjustment.server') or nice_def
nice_cln = get_int('nice.adjustment.client') or nice_def
- ionice_def = get_int('ionice.adjustment')
+ ionice_def = props.get('ionice.adjustment')
if ionice_def is None: ionice_def = 'idle'
if ionice_def is '': ionice_def = 'none'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-29 04:20:00
|
Revision: 730
http://safekeep.svn.sourceforge.net/safekeep/?rev=730&view=rev
Author: dimi
Date: 2010-11-29 04:19:55 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
Do not die if we can't set effective UID, just issue a warning
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-29 04:16:54 UTC (rev 729)
+++ safekeep/trunk/safekeep 2010-11-29 04:19:55 UTC (rev 730)
@@ -1507,8 +1507,11 @@
if backup_user and backup_user != work_user:
(user, pswd, uid, gid, gecos, home_dir, shell) = pwd.getpwnam(backup_user)
if mode is not 'keys':
- os.setregid(gid, gid)
- os.setreuid(uid, uid)
+ try:
+ os.setregid(gid, gid)
+ os.setreuid(uid, uid)
+ except OSError, ex:
+ warn("Cannot setreuid(): " + str(ex))
os.environ['HOME'] = home_dir
else:
backup_user = work_user
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-29 04:26:14
|
Revision: 731
http://safekeep.svn.sourceforge.net/safekeep/?rev=731&view=rev
Author: dimi
Date: 2010-11-29 04:26:08 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
Avoid errors when ionice is an integer
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-29 04:19:55 UTC (rev 730)
+++ safekeep/trunk/safekeep 2010-11-29 04:26:08 UTC (rev 731)
@@ -914,7 +914,7 @@
if ionice is 'idle':
args.extend([ionice_cmd, '-c3', '-t'])
else:
- args.extend([ionice_cmd, '-c2', '-n' + ionice, '-t'])
+ args.extend([ionice_cmd, '-c2', '-n%s' % (ionice), '-t'])
else:
warn('ionice(1) not available, ignoring ionice.adjustment')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-29 04:29:15
|
Revision: 732
http://safekeep.svn.sourceforge.net/safekeep/?rev=732&view=rev
Author: dimi
Date: 2010-11-29 04:29:09 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
Hide output when trying an external command
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-29 04:26:08 UTC (rev 731)
+++ safekeep/trunk/safekeep 2010-11-29 04:29:09 UTC (rev 732)
@@ -231,7 +231,7 @@
def try_to_run(args):
try:
- rc, out = do_spawn(args)
+ rc, out = do_spawn(args, None, True)
except OSError, ex:
return False
return rc in (0,1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-29 04:32:26
|
Revision: 733
http://safekeep.svn.sourceforge.net/safekeep/?rev=733&view=rev
Author: dimi
Date: 2010-11-29 04:32:20 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
Avoid NPE
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-29 04:29:09 UTC (rev 732)
+++ safekeep/trunk/safekeep 2010-11-29 04:32:20 UTC (rev 733)
@@ -1248,6 +1248,7 @@
# parses authozied_keys, see sshd(8) man page for details
def parse_authorized_keys(keystext):
+ if not keystext: keystext = ''
keys = []
for line in keystext.splitlines():
line = line.strip()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-29 04:56:21
|
Revision: 734
http://safekeep.svn.sourceforge.net/safekeep/?rev=734&view=rev
Author: dimi
Date: 2010-11-29 04:56:15 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
Fix the interpretation of the status during the call().
Given up on explicit shell invokation when doing keys management.
Better display during debug (when invoking external commands)
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-29 04:32:20 UTC (rev 733)
+++ safekeep/trunk/safekeep 2010-11-29 04:56:15 UTC (rev 734)
@@ -145,7 +145,11 @@
log(msg + extra, 'ERR')
def do_spawn(args, stdin=None, stdout=False):
- debug('Run [' + ' '.join(args) + ']')
+ if isinstance(args, types.StringTypes):
+ debug('Run [' + args + ']')
+ else:
+ debug('Run [' + ' '.join(args) + ']')
+
_shell = isinstance(args, types.StringTypes)
if stdin:
_stdin = PIPE
@@ -225,7 +229,7 @@
# if it fails it returns None, otherwise it returns the output
def call(args, stdin=None):
rc, out = _spawn(args, stdin, stdout=True)
- if not rc:
+ if rc:
return None
return out
@@ -1219,7 +1223,7 @@
if identity: basessh += ' -i %s' % (commands.mkarg(identity))
if status or deploy:
- cmd = '%s %s@%s "if test -f .ssh/authorized_keys; then cat .ssh/authorized_keys; fi"' % (basessh, cfg['user'], cfg['host'])
+ cmd = [basessh, '%s@%s' % (cfg['user'], cfg['host']), "if test -f .ssh/authorized_keys; then cat .ssh/authorized_keys; fi"]
authtext = call(cmd)
if authtext is None:
warn('%s: Failed to read the authorized_keys file.' % id)
@@ -1239,7 +1243,7 @@
if status:
print '%s: Keys will be deployed on the client.' % id
if deploy:
- cmd = '%s %s@%s "umask 077; test -d .ssh || mkdir .ssh; cat >> .ssh/authorized_keys"' % (basessh, cfg['user'], cfg['host'])
+ cmd = [basessh, '%s@%s' % (cfg['user'], cfg['host']), "umask 077; test -d .ssh || mkdir .ssh; cat >> .ssh/authorized_keys"]
keys = '%s\n' % '\n'.join([key[4] for key in new_keys])
out = call(cmd, stdin=keys)
if out is None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2010-11-29 05:52:41
|
Revision: 735
http://safekeep.svn.sourceforge.net/safekeep/?rev=735&view=rev
Author: dimi
Date: 2010-11-29 05:52:35 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
Use trickle in a more compatible way
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-29 04:56:15 UTC (rev 734)
+++ safekeep/trunk/safekeep 2010-11-29 05:52:35 UTC (rev 735)
@@ -921,33 +921,32 @@
args.extend([ionice_cmd, '-c2', '-n%s' % (ionice), '-t'])
else:
warn('ionice(1) not available, ignoring ionice.adjustment')
+
+ # handle bandwidth limiting via trickle
+ def get_bw(vals, d):
+ return vals.get(d) or vals.get('overall')
+ def get_bandwidth(cfg, d):
+ return get_bw(cfg['bw'], d) or get_bw(default_bandwidth, d)
+ trickle = []
+ limit_dl = get_bandwidth(cfg, 'download')
+ limit_ul = get_bandwidth(cfg, 'upload')
+ if limit_dl or limit_ul:
+ trickle.extend([trickle_cmd])
+ if verbosity_trickle: trickle.extend([verbosity_trickle])
+ if limit_dl:
+ trickle.extend(['-d', str(limit_dl)])
+ if limit_ul:
+ trickle.extend(['-u', str(limit_ul)])
+ if len(trickle):
+ if not try_to_run([trickle_cmd, '-V']):
+ warn('Trickle not available, bandwidth limiting disabled')
+ trickle = []
+ args.extend(trickle)
args.extend(['rdiff-backup'])
if cfg['host']:
- trickle = ''
-
- def get_bw(vals, dir):
- return vals.get(dir) or vals.get('overall')
-
- def get_bandwidth(cfg, dir):
- return get_bw(cfg['bw'], dir) or get_bw(default_bandwidth, dir)
-
- limit_dl = get_bandwidth(cfg, 'download')
- limit_ul = get_bandwidth(cfg, 'upload')
- if limit_dl or limit_ul:
- trickle = trickle_cmd + ' ' + verbosity_trickle
- if limit_dl:
- trickle += ' -d ' + str(limit_dl)
- if limit_ul:
- trickle += ' -u ' + str(limit_ul)
-
- if trickle:
- if not try_to_run(trickle_cmd + ' -V'):
- warn('Trickle not available, bandwidth limiting disabled')
- trickle = ''
-
- schema = '%s ssh %s -i %s %%s rdiff-backup --server' % (trickle, verbosity_ssh, cfg['key_data'])
+ schema = 'ssh %s -i %s %%s rdiff-backup --server' % (verbosity_ssh, cfg['key_data'])
args.extend(['--remote-schema', schema])
if force:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-03-03 15:56:22
|
Revision: 736
http://safekeep.svn.sourceforge.net/safekeep/?rev=736&view=rev
Author: dimi
Date: 2011-03-03 15:56:16 +0000 (Thu, 03 Mar 2011)
Log Message:
-----------
Oliver Henshaw <oli...@gm...>
Only check the caller that could be null.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-29 05:52:35 UTC (rev 735)
+++ safekeep/trunk/safekeep 2011-03-03 15:56:16 UTC (rev 736)
@@ -1226,6 +1226,7 @@
authtext = call(cmd)
if authtext is None:
warn('%s: Failed to read the authorized_keys file.' % id)
+ authtext = ''
auth_keys = parse_authorized_keys(authtext)
this_keys = parse_authorized_keys(output)
new_keys = []
@@ -1251,7 +1252,6 @@
# parses authozied_keys, see sshd(8) man page for details
def parse_authorized_keys(keystext):
- if not keystext: keystext = ''
keys = []
for line in keystext.splitlines():
line = line.strip()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-03-03 15:57:54
|
Revision: 737
http://safekeep.svn.sourceforge.net/safekeep/?rev=737&view=rev
Author: dimi
Date: 2011-03-03 15:57:48 +0000 (Thu, 03 Mar 2011)
Log Message:
-----------
Oliver Henshaw <oli...@gm...>
do_spawn wrongly returned stdout as a multi-line string,
rather than the array of strings most callers were
expecting. One caller was improperly converted from direct
subprocess use to the call() wrapper, so its
output is joined to one long string as a minimal fix.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-03-03 15:56:16 UTC (rev 736)
+++ safekeep/trunk/safekeep 2011-03-03 15:57:48 UTC (rev 737)
@@ -188,9 +188,9 @@
child_out.close()
if use_subprocess:
- return (proc.wait(), ''.join(lines))
+ return (proc.wait(), lines)
else:
- return (0, ''.join(lines))
+ return (0, lines)
def _spawn(args, stdin=None, stdout=False):
@@ -1226,8 +1226,8 @@
authtext = call(cmd)
if authtext is None:
warn('%s: Failed to read the authorized_keys file.' % id)
- authtext = ''
- auth_keys = parse_authorized_keys(authtext)
+ authtext = []
+ auth_keys = parse_authorized_keys(''.join(authtext))
this_keys = parse_authorized_keys(output)
new_keys = []
for this_key in this_keys:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-03-03 15:59:05
|
Revision: 738
http://safekeep.svn.sourceforge.net/safekeep/?rev=738&view=rev
Author: dimi
Date: 2011-03-03 15:58:54 +0000 (Thu, 03 Mar 2011)
Log Message:
-----------
Oliver Henshaw <oli...@gm...>
The 'authtext' caller can now use the output from
call() without any further processing, and the 'output'
caller needs only minor changes in preparation.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-03-03 15:57:48 UTC (rev 737)
+++ safekeep/trunk/safekeep 2011-03-03 15:58:54 UTC (rev 738)
@@ -1177,7 +1177,7 @@
cmds = ['safekeep --client', 'rdiff-backup --server --restrict-read-only /']
privatekeyfiles = [cfg.get('key_ctrl'), cfg.get('key_data')]
- lines = []
+ output = []
keys_ok = False
for (cmd, privatekeyfile) in zip(cmds, privatekeyfiles):
publickeyfile = privatekeyfile + '.pub'
@@ -1207,14 +1207,13 @@
publickey = fin.read()
fin.close()
line = 'command="%s%s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s' % (nice_cmd, cmd, publickey.strip())
- lines.append(line)
+ output.append(line)
else:
keys_ok = True
if not keys_ok:
continue
- output = '\n'.join(lines)
if dump:
print output
@@ -1227,7 +1226,7 @@
if authtext is None:
warn('%s: Failed to read the authorized_keys file.' % id)
authtext = []
- auth_keys = parse_authorized_keys(''.join(authtext))
+ auth_keys = parse_authorized_keys(authtext)
this_keys = parse_authorized_keys(output)
new_keys = []
for this_key in this_keys:
@@ -1253,7 +1252,7 @@
# parses authozied_keys, see sshd(8) man page for details
def parse_authorized_keys(keystext):
keys = []
- for line in keystext.splitlines():
+ for line in keystext:
line = line.strip()
if not line or line[0] == '#': continue
if line[0] in '0123456789':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-03-03 16:12:51
|
Revision: 739
http://safekeep.svn.sourceforge.net/safekeep/?rev=739&view=rev
Author: dimi
Date: 2011-03-03 16:12:45 +0000 (Thu, 03 Mar 2011)
Log Message:
-----------
A bit cleaner error message when we can't get to the authorized_keys file.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-03-03 15:58:54 UTC (rev 738)
+++ safekeep/trunk/safekeep 2011-03-03 16:12:45 UTC (rev 739)
@@ -1224,7 +1224,7 @@
cmd = [basessh, '%s@%s' % (cfg['user'], cfg['host']), "if test -f .ssh/authorized_keys; then cat .ssh/authorized_keys; fi"]
authtext = call(cmd)
if authtext is None:
- warn('%s: Failed to read the authorized_keys file.' % id)
+ warn('%s: Failed to read the %s@%s:~/.ssh/authorized_keys file.' % (id, cfg['user'], cfg['host']))
authtext = []
auth_keys = parse_authorized_keys(authtext)
this_keys = parse_authorized_keys(output)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-03-03 16:19:17
|
Revision: 740
http://safekeep.svn.sourceforge.net/safekeep/?rev=740&view=rev
Author: dimi
Date: 2011-03-03 16:19:11 +0000 (Thu, 03 Mar 2011)
Log Message:
-----------
Bail if we can't read the .ssh/authorized_keys file while deploying keys.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-03-03 16:12:45 UTC (rev 739)
+++ safekeep/trunk/safekeep 2011-03-03 16:19:11 UTC (rev 740)
@@ -1224,8 +1224,8 @@
cmd = [basessh, '%s@%s' % (cfg['user'], cfg['host']), "if test -f .ssh/authorized_keys; then cat .ssh/authorized_keys; fi"]
authtext = call(cmd)
if authtext is None:
- warn('%s: Failed to read the %s@%s:~/.ssh/authorized_keys file.' % (id, cfg['user'], cfg['host']))
- authtext = []
+ error('%s: Failed to read the %s@%s:~/.ssh/authorized_keys file.' % (id, cfg['user'], cfg['host']))
+ continue
auth_keys = parse_authorized_keys(authtext)
this_keys = parse_authorized_keys(output)
new_keys = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-03-06 17:50:59
|
Revision: 748
http://safekeep.svn.sourceforge.net/safekeep/?rev=748&view=rev
Author: dimi
Date: 2011-03-06 17:50:53 +0000 (Sun, 06 Mar 2011)
Log Message:
-----------
Update version
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-03-06 17:50:08 UTC (rev 747)
+++ safekeep/trunk/safekeep 2011-03-06 17:50:53 UTC (rev 748)
@@ -68,7 +68,7 @@
cmd = "<Missing>"
PROTOCOL = "1.1"
-VERSION = "1.3.1"
+VERSION = "1.3.2"
VEBOSITY_BY_CLASS = {'DBG': 3, 'INFO': 2, 'WARN': 1, 'ERR': 0}
######################################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-06-11 15:52:33
|
Revision: 755
http://safekeep.svn.sourceforge.net/safekeep/?rev=755&view=rev
Author: dimi
Date: 2011-06-11 15:52:27 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Have 'try_to_run' return the captured output of the command
rather than just a boolean for additional flexibility.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-06-11 15:20:25 UTC (rev 754)
+++ safekeep/trunk/safekeep 2011-06-11 15:52:27 UTC (rev 755)
@@ -237,8 +237,10 @@
try:
rc, out = do_spawn(args, None, True)
except OSError, ex:
- return False
- return rc in (0,1)
+ return None
+ if not rc in (0,1):
+ return None
+ return out or ''
def send_notification(email, smtp):
global logbuf
@@ -914,7 +916,7 @@
ionice_cmd = 'ionice'
if ionice and ionice != 'none':
- if try_to_run(ionice_cmd):
+ if try_to_run(ionice_cmd) is not None:
if ionice is 'idle':
args.extend([ionice_cmd, '-c3', '-t'])
else:
@@ -938,7 +940,7 @@
if limit_ul:
trickle.extend(['-u', str(limit_ul)])
if len(trickle):
- if not try_to_run([trickle_cmd, '-V']):
+ if try_to_run([trickle_cmd, '-V']) is not None:
warn('Trickle not available, bandwidth limiting disabled')
trickle = []
args.extend(trickle)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-06-11 15:59:13
|
Revision: 756
http://safekeep.svn.sourceforge.net/safekeep/?rev=756&view=rev
Author: dimi
Date: 2011-06-11 15:59:08 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Do not use the -t ionice switch unless it is supported, it is missnig in some versions.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-06-11 15:52:27 UTC (rev 755)
+++ safekeep/trunk/safekeep 2011-06-11 15:59:08 UTC (rev 756)
@@ -916,11 +916,15 @@
ionice_cmd = 'ionice'
if ionice and ionice != 'none':
- if try_to_run(ionice_cmd) is not None:
+ ionice_out = try_to_run(ionice_cmd, '-h')
+ if ionice_out is not None:
if ionice is 'idle':
- args.extend([ionice_cmd, '-c3', '-t'])
+ args.extend([ionice_cmd, '-c3'])
else:
- args.extend([ionice_cmd, '-c2', '-n%s' % (ionice), '-t'])
+ args.extend([ionice_cmd, '-c2', '-n%s' % (ionice)])
+
+ if ionice_out.find('-t') > 0:
+ args.extend(['-t'])
else:
warn('ionice(1) not available, ignoring ionice.adjustment')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-06-11 16:07:29
|
Revision: 757
http://safekeep.svn.sourceforge.net/safekeep/?rev=757&view=rev
Author: dimi
Date: 2011-06-11 16:07:23 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Try to run ionice and make sure that it works before
we try to use it. This should take care of system where
we don't have enough privileges to run ionice(1), and
we still want to proceed.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-06-11 15:59:08 UTC (rev 756)
+++ safekeep/trunk/safekeep 2011-06-11 16:07:23 UTC (rev 757)
@@ -918,13 +918,20 @@
if ionice and ionice != 'none':
ionice_out = try_to_run(ionice_cmd, '-h')
if ionice_out is not None:
+ ionice_args = []
if ionice is 'idle':
- args.extend([ionice_cmd, '-c3'])
+ ionice_args.extend(['-c3'])
else:
- args.extend([ionice_cmd, '-c2', '-n%s' % (ionice)])
+ ionice_args.extend(['-c2', '-n%s' % (ionice)])
if ionice_out.find('-t') > 0:
- args.extend(['-t'])
+ ionice_args.extend(['-t'])
+
+ if try_to_run(ionice_cmd, ionice_args + ['/bin/true']) is not None:
+ args.append(ionice_cmd)
+ args.extend(ionice_args)
+ else:
+ warn('ionice(1) fails, ignoring ionice.adjustment')
else:
warn('ionice(1) not available, ignoring ionice.adjustment')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-06-11 16:14:20
|
Revision: 758
http://safekeep.svn.sourceforge.net/safekeep/?rev=758&view=rev
Author: dimi
Date: 2011-06-11 16:14:14 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Fix a few bugs introduced by the previous patches
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-06-11 16:07:23 UTC (rev 757)
+++ safekeep/trunk/safekeep 2011-06-11 16:14:14 UTC (rev 758)
@@ -916,18 +916,18 @@
ionice_cmd = 'ionice'
if ionice and ionice != 'none':
- ionice_out = try_to_run(ionice_cmd, '-h')
+ ionice_out = try_to_run([ionice_cmd, '-h'])
if ionice_out is not None:
- ionice_args = []
+ ionice_args = []
if ionice is 'idle':
ionice_args.extend(['-c3'])
else:
ionice_args.extend(['-c2', '-n%s' % (ionice)])
- if ionice_out.find('-t') > 0:
+ if ''.join(ionice_out).find('-t') > 0:
ionice_args.extend(['-t'])
- if try_to_run(ionice_cmd, ionice_args + ['/bin/true']) is not None:
+ if try_to_run([ionice_cmd] + ionice_args + ['/bin/true']) is not None:
args.append(ionice_cmd)
args.extend(ionice_args)
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-09-30 00:20:03
|
Revision: 760
http://safekeep.svn.sourceforge.net/safekeep/?rev=760&view=rev
Author: dimi
Date: 2011-09-30 00:19:57 +0000 (Fri, 30 Sep 2011)
Log Message:
-----------
Marco Bozzolan <ma...@s1...>
Avoid exception when an 'email.to' is specified without an 'email.from'
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-08-31 13:02:44 UTC (rev 759)
+++ safekeep/trunk/safekeep 2011-09-30 00:19:57 UTC (rev 760)
@@ -1375,6 +1375,7 @@
global backup_user, home_dir, base_dir
mode = None
email = []
+ email_from = None
smtp = None
cfgfile = None
cfglocs = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2011-09-30 00:22:08
|
Revision: 761
http://safekeep.svn.sourceforge.net/safekeep/?rev=761&view=rev
Author: dimi
Date: 2011-09-30 00:22:02 +0000 (Fri, 30 Sep 2011)
Log Message:
-----------
Marco Bozzolan <ma...@s1...>
Use the subprocess module when required,
avoid noisy deprecation error.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-09-30 00:19:57 UTC (rev 760)
+++ safekeep/trunk/safekeep 2011-09-30 00:22:02 UTC (rev 761)
@@ -1065,7 +1065,12 @@
cmd.extend(['-T', '-i', cfg['key_ctrl'], '-l', cfg['user'], cfg['host']])
cmd.extend(['safekeep', '--client'])
- (cin,cout) = os.popen2(cmd)
+ if use_subprocess:
+ subp = subprocess.Popen(cmd, stdin=PIPE, stdout=PIPE)
+ cin = subp.stdin
+ cout = subp.stdout
+ else:
+ (cin, cout) = os.popen2(cmd)
cin.write('ALOHA: %s, %s\n' % (PROTOCOL, VERSION))
cin.flush()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|