|
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.
|