|
From: <fcr...@us...> - 2012-01-01 03:28:22
|
Revision: 785
http://safekeep.svn.sourceforge.net/safekeep/?rev=785&view=rev
Author: fcrawford
Date: 2012-01-01 03:28:15 +0000 (Sun, 01 Jan 2012)
Log Message:
-----------
Added option to set SSH port for each host as requested by Ken Bass
Modified Paths:
--------------
safekeep/trunk/doc/safekeep.backup.txt
safekeep/trunk/safekeep
Modified: safekeep/trunk/doc/safekeep.backup.txt
===================================================================
--- safekeep/trunk/doc/safekeep.backup.txt 2011-12-30 09:27:22 UTC (rev 784)
+++ safekeep/trunk/doc/safekeep.backup.txt 2012-01-01 03:28:15 UTC (rev 785)
@@ -88,6 +88,12 @@
This is different from leaving it blank, as it will establish a
SSH session and use the user specified by `/backup/host/@user`.
Optional, defaults to local access.
+
+/backup/host/@port::
+ The network port to use when connecting to the client. This must
+ be a number and is passed to the network connection agent, usually
+ SSH.
+ Optional, default to not passing any port specification.
/backup/host/@user::
The user name to use when connecting to the client. This user
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-12-30 09:27:22 UTC (rev 784)
+++ safekeep/trunk/safekeep 2012-01-01 03:28:15 UTC (rev 785)
@@ -364,12 +364,15 @@
host_el = backup_el.getElementsByTagName('host')
if host_el:
host = host_el[0].getAttribute('name')
+ port = host_el[0].getAttribute('port')
user = host_el[0].getAttribute('user')
nice = host_el[0].getAttribute('nice')
key_ctrl = host_el[0].getAttribute('key-ctrl')
key_data = host_el[0].getAttribute('key-data')
else:
- host = user = nice = key_ctrl = key_data = None
+ host = port = user = nice = key_ctrl = key_data = None
+ if host and port and not port.isdigit():
+ raise ConfigException('Host port must be a number: "%s"' % port)
if host and not user:
user = 'root'
if host and not key_ctrl:
@@ -459,7 +462,7 @@
'/var/named/chroot/var/run', '/var/named/chroot/var/tmp' ]
cludes = [{ 'type' : 'exclude', 'path' : path, 'glob' : None, 'regexp' : None } for path in path_xcludes]
- return { 'id': id, 'host' : host, 'nice' : nice, 'user' : user, 'key_ctrl' : key_ctrl, 'key_data' : key_data,
+ return { 'id': id, 'host' : host, 'port' : port, 'nice' : nice, 'user' : user, 'key_ctrl' : key_ctrl, 'key_data' : key_data,
'dir' : dir, 'retention' : retention, 'dumps' : dumps, 'snaps' : snaps, 'script' : script,
'cludes' : cludes, 'data_options' : data_options, 'options' : options, 'bw' : bw}
@@ -1110,7 +1113,9 @@
args.extend(['rdiff-backup'])
if cfg['host']:
- schema = 'ssh %s -i %s %%s rdiff-backup --server' % (verbosity_ssh, cfg['key_data'])
+ basessh = 'ssh'
+ if cfg['port']: basessh += ' -p %s' % cfg['port']
+ schema = '%s %s -i %s %%s rdiff-backup --server' % (basessh, verbosity_ssh, cfg['key_data'])
args.extend(['--remote-schema', schema])
if force:
@@ -1213,6 +1218,7 @@
if cfg['host']:
cmd.extend(['ssh'])
if verbosity_ssh: cmd.extend([verbosity_ssh])
+ if cfg['port']: cmd.extend(['-p', cfg['port']])
cmd.extend(['-T', '-i', cfg['key_ctrl'], '-l', cfg['user'], cfg['host']])
cmd.extend(['safekeep', '--client'])
@@ -1409,6 +1415,7 @@
print output
basessh = 'ssh'
+ if cfg['port']: basessh += ' -p %s' % cfg['port']
if identity: basessh += ' -i %s' % (commands.mkarg(identity))
if status or deploy:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|