-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

Attached patch, when applied to the master branch, incorporates
paraproxy support in fabric, allowing one to use ProxyCommands within
fabric recipes. I've also found that paraproxy enters an infinite
recursive loop when trying to parse 'ProxyCommand ssh some.host
somecommand --with-parameters'. It seems that only 'ProxyCommand ssh
some.host somecommand' is supported. I've attached a patch for paraproxy
fixing this, which has also been submitted to the author of paraproxy.

Kind Regards,

Lex van Roon
- -- 
LRO-RIPE | E335B1F1 | 349B 6FD8 8256 4C2E 26EC B41C B9A6 8CF0 E335 B1F1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJN5MGqAAoJELmmjPDjNbHxwKQH/1zCqQiusLbsRmFc1UMorItD
E60q1BjwLPRV0DQ8ZtJL/l9c1LWg+b3WJGEl1bt7addAGwyzUh1cXMugEPRK4TiK
MwvyFctrzQA1vmM95LA3xihzXa16mR32hcYluwI6pQp3LsGKHPfHM/jkublTT1rD
WTlWAfM5Sae5pn8vBOZrclo+Gf8JlJZ4zzxWiw9lsEi4UO/pUfdarsNLV9rPts6U
fQpdA6Zwebzu2z2AG2gE70DYAMS9/w32v/dC519+Z7nrc5gDl9wgxrGPI+99fnMb
kasH1iT9e/VqYiz4RIF7jYBfMpOkRml/09Z8HRZ8R5ms/3UoKOmh8xDM812zKKk=
=qdeT
-----END PGP SIGNATURE-----
diff --git a/fabric/network.py b/fabric/network.py
index e12203c..330af7e 100644
--- a/fabric/network.py
+++ b/fabric/network.py
@@ -16,11 +16,15 @@ from fabric.auth import get_password, set_password
 try:
     import warnings
     warnings.simplefilter('ignore', DeprecationWarning)
+    import paraproxy
     import paramiko as ssh
 except ImportError:
-    abort("paramiko is a required module. Please install it:\n\t$ sudo easy_install paramiko")
-
-
+    try:
+        import warnings
+        warnings.simplefilter('ignore', DeprecationWarning)
+        import paramiko as ssh
+    except ImportError:
+        abort("paramiko is a required module. Please install it:\n\t$ sudo easy_install paramiko") 
 
 host_pattern = r'((?P<user>.+)@)?(?P<host>[^:]+)(:(?P<port>\d+))?'
 host_regex = re.compile(host_pattern)
diff --git a/paraproxy/__init__.py b/paraproxy/__init__.py
index 3e97a04..0d8eb2b 100644
--- a/paraproxy/__init__.py
+++ b/paraproxy/__init__.py
@@ -87,8 +87,10 @@ def __paramiko_SSHClient_proxy_cmdchain(self, hostname, rec=0):
 		exe = os.path.basename(command_args[0].lower())
 		if exe.lower() == 'ssh' or exe.lower() == 'ssh.exe':
 			# command is SSH, extract the host and the remote command
-			remote_cmd = command_args.pop()
-			remote_host = command_args.pop()
+			# Assume the first parameter is the remote host and the rest
+			# the commands we need to run on the host
+			remote_host = command_args[1]
+			remote_cmd = " ".join(command_args[2:])
 
 			chain = [(remote_host, remote_cmd.replace('%h', hostname).replace('%p', port))]
 			next_hop = __paramiko_SSHClient_proxy_cmdchain(self, remote_host, rec+1)

Attachment: fabric-master-paraproxy-support.diff.sig
Description: Binary data

Attachment: paraproxy-1.2-parse-proxycommands.diff.sig
Description: Binary data

_______________________________________________
Fab-user mailing list
Fab-user@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to