|
From: <di...@us...> - 2010-11-19 15:07:50
|
Revision: 688
http://safekeep.svn.sourceforge.net/safekeep/?rev=688&view=rev
Author: dimi
Date: 2010-11-19 15:07:44 +0000 (Fri, 19 Nov 2010)
Log Message:
-----------
Get rid of cmd_run function.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-19 14:56:46 UTC (rev 687)
+++ safekeep/trunk/safekeep 2010-11-19 15:07:44 UTC (rev 688)
@@ -179,12 +179,6 @@
return False
return rc in (0,1)
-def cmd_run(args):
- argslist = args_to_list(args)
- debug('Run [' + ' '.join(argslist) + ']')
- p = subprocess.Popen(argslist, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
- return (p.stdin, p.stdout)
-
def send_notification(email, smtp):
global logbuf
if not logbuf: return
@@ -545,10 +539,7 @@
(dump['file'], dump['db'], e))
def lvm_snap_information():
- (cin, cout) = cmd_run(['lvs', '--separator', ':', '--noheadings'])
- lines = cout.readlines()
- cout.close()
- cin.close()
+ lines = call(['lvs', '--separator', ':', '--noheadings']) or ''
lvms = []
for line in lines:
if line.count(':') > 3:
@@ -558,10 +549,7 @@
return lvms
def mount_information(reverse = False):
- (cin, cout) = cmd_run(['mount'])
- lines = cout.readlines()
- cout.close()
- cin.close()
+ lines = call(['mount']) or ''
mounts = []
pattern = re.compile(r"^(\S+) on (.+) type (\S+) \((\S+)\)")
if reverse:
@@ -979,11 +967,14 @@
if cfg['retention'] and os.path.isdir(rdiff_logdir) and not cleanup:
do_server_data_cleanup(cfg)
+ cmd = []
if cfg['host']:
- cmd = 'ssh %s -T -i %s -l %s %s safekeep --client' % (verbosity_ssh, cfg['key_ctrl'], cfg['user'], cfg['host'])
- else:
- cmd = 'safekeep --client'
- (cin, cout) = cmd_run(cmd)
+ cmd.extend(['ssh', verbosity_ssh, '-T', '-i', cfg['key_ctrl'], '-l', cfg['user'], cfg['host'])
+ cmd.extend(['safekeep', '--client'])
+
+ proc = subprocess.Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
+ cin = proc.stdin
+ cout = proc.stdout
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.
|