From: Alina Quereilhac Date: Mon, 7 Jul 2014 23:26:49 +0000 (+0200) Subject: Removing repeated command declaration in examples/linux/file_transfer.py X-Git-Tag: nepi-3.2.0~126 X-Git-Url: http://git.onelab.eu/?p=nepi.git;a=commitdiff_plain;h=b1a48236183a6acd0a67be0aaedfb528788725b4 Removing repeated command declaration in examples/linux/file_transfer.py --- diff --git a/examples/linux/file_transfer.py b/examples/linux/file_transfer.py index ed848e40..347f797b 100644 --- a/examples/linux/file_transfer.py +++ b/examples/linux/file_transfer.py @@ -32,32 +32,22 @@ from nepi.execution.resource import ResourceAction, ResourceState from optparse import OptionParser, SUPPRESS_HELP import os -usage = ("usage: %prog -a -b -u -i ") - -parser = OptionParser(usage = usage) -parser.add_option("-a", "--hostname1", dest="hostname1", - help="Remote host 1", type="str") -parser.add_option("-b", "--hostname2", dest="hostname2", - help="Remote host 2", type="str") -parser.add_option("-u", "--username", dest="username", - help="Username to SSH to remote host", type="str") -parser.add_option("-i", "--ssh-key", dest="ssh_key", - help="Path to private SSH key to be used for connection", - type="str") -(options, args) = parser.parse_args() - -hostname1 = options.hostname1 -hostname2 = options.hostname2 -username = options.username -ssh_key = options.ssh_key + +# The pluser and plpassword are the ones used to login in the PlanetLab web +# site. Replace with your own user and password account information. +pl_password = os.environ.get("PL_PASS") +pl_user = os.environ.get("PL_USER") +username = os.environ.get("PL_SLICE") +ssh_key = "/home/alina/.ssh/id_rsa_planetlab" ## Create the experiment controller ec = ExperimentController(exp_id = "file_transfer") ## Register node 1 -node1 = ec.register_resource("LinuxNode") +node1 = ec.register_resource("PlanetlabNode") # Set the hostname of the first node to use for the experiment -ec.set(node1, "hostname", hostname1) +ec.set(node1, "pluser", pl_user) +ec.set(node1, "plpassword", pl_password) # username should be your SSH user ec.set(node1, "username", username) # Absolute path to the SSH private key @@ -68,7 +58,10 @@ ec.set(node1, "cleanExperiment", True) ec.set(node1, "cleanProcesses", True) ## Register node 2 -node2 = ec.register_resource("LinuxNode") +node2 = ec.register_resource("PlanetlabNode") +# Set the hostname of the first node to use for the experiment +ec.set(node2, "pluser", pl_user) +ec.set(node2, "plpassword", pl_password) # Set the hostname of the first node to use for the experiment ec.set(node2, "hostname", hostname2) # username should be your SSH user