+def get_options():
+ pl_slice = os.environ.get("PL_SLICE")
+
+ # We use a specific SSH private key for PL if the PL_SSHKEY is specified or the
+ # id_rsa_planetlab exists
+ default_key = "%s/.ssh/id_rsa_planetlab" % (os.environ['HOME'])
+ default_key = default_key if os.path.exists(default_key) else None
+ pl_ssh_key = os.environ.get("PL_SSHKEY", default_key)
+
+ usage = "usage: %prog -s <pl-user> -m <movie> -c -e <exp-id> -i <ssh_key>"
+
+ parser = OptionParser(usage=usage)
+ parser.add_option("-s", "--pl-user", dest="pl_user",
+ help="PlanetLab slicename", default = pl_slice, type="str")
+ parser.add_option("-m", "--movie", dest="movie",
+ help="Stream movie", type="str")
+ parser.add_option("-e", "--exp-id", dest="exp_id",
+ help="Label to identify experiment", type="str")
+ parser.add_option("-i", "--pl-ssh-key", dest="pl_ssh_key",
+ help="Path to private SSH key to be used for connection",
+ default = pl_ssh_key, type="str")
+
+ (options, args) = parser.parse_args()
+
+ if not options.movie:
+ parser.error("movie is a required argument")
+
+ return (options.pl_user, options.movie, options.exp_id, options.pl_ssh_key)
+
+