aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvmaffione <v.maffione@gmail.com>2017-04-14 09:18:41 +0000
committervmaffione <v.maffione@gmail.com>2017-04-14 09:18:41 +0000
commitca1d77df271defb08d5f73b54398491d1049c9f9 (patch)
treeb6cec9dc10c7a7677a6480c2d934e5e2917a59de
parent5c8c06ec2dc08fc326357395b3044874122de658 (diff)
parentcb4bfa4e632a70f786d4c27b0c02a47b774b9297 (diff)
downloadrumba-ca1d77df271defb08d5f73b54398491d1049c9f9.tar.gz
rumba-ca1d77df271defb08d5f73b54398491d1049c9f9.zip
Merge branch 'proxycmd' into 'master'
rumba: Add ProxyCommand for jFed See merge request !31
-rw-r--r--rumba/model.py3
-rw-r--r--rumba/ssh_support.py16
-rw-r--r--rumba/testbeds/jfed.py5
3 files changed, 21 insertions, 3 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 613a6be..9e6b40d 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -128,9 +128,10 @@ class NormalDIF(DIF):
# SSH Configuration
#
class SSHConfig:
- def __init__(self, hostname, port=22):
+ def __init__(self, hostname, port=22, proxycommand=None):
self.hostname = hostname
self.port = port
+ self.proxycommand = proxycommand
# A node in the experiment
#
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index 30ada62..e66db43 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -49,10 +49,16 @@ def execute_commands(testbed, ssh_config, commands, time_out=3):
'''
ssh_client = get_ssh_client()
+ if ssh_config.proxycommand != None:
+ proxy = paramiko.ProxyCommand(ssh_config.proxycommand)
+ else:
+ proxy = None
+
try:
ssh_client.connect(ssh_config.hostname, ssh_config.port,
testbed.username, testbed.password,
- look_for_keys=True, timeout=time_out)
+ look_for_keys=True, timeout=time_out,
+ sock=proxy)
o = ""
for command in commands:
print("%s@%s:%s >> %s" % (testbed.username,
@@ -101,11 +107,17 @@ def copy_file_to_testbed(testbed, ssh_config, text, file_name):
'''
ssh_client = get_ssh_client()
+ if ssh_config.proxycommand != None:
+ proxy = paramiko.ProxyCommand(ssh_config.proxycommand)
+ else:
+ proxy = None
+
try:
ssh_client.connect(ssh_config.hostname, ssh_config.port,
testbed.username,
testbed.password,
- look_for_keys=True)
+ look_for_keys=True,
+ sock=proxy)
cmd = "touch " + file_name + \
"; chmod a+rwx " + file_name
diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py
index 0dfc904..f09bb4e 100644
--- a/rumba/testbeds/jfed.py
+++ b/rumba/testbeds/jfed.py
@@ -113,6 +113,11 @@ class Testbed(mod.Testbed):
auth_name_r = self.auth_name.replace(".", "-")
node.ssh_config.hostname = node.name + "." + self.exp_name + "." + \
auth_name_r + "." + self.auth_name
+ node.ssh_config.proxycommand = "ssh -i '" + self.cert_file + \
+ "' -o StrictHostKeyChecking=no " + \
+ self.username + \
+ "@bastion.test.iminds.be nc " + \
+ node.ssh_config.hostname + " 22"
subprocess.call(["java", "-jar", self.jfed_jar, "create", "-S", \
self.proj_name, "--rspec", \