- Timestamp:
- Nov 23, 2008 4:37:28 PM (16 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 1653a08
- Parents:
- 0b123ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_experiment_control.py
r0b123ff r721705e9 2 2 3 3 import os,sys 4 5 4 6 5 import re … … 203 202 self.fedkit = None 204 203 205 # XXX 206 self.ssh_pubkey_file = "/users/faber/.ssh/id_rsa.pub" 207 self.ssh_type = "rsa" 204 self.ssh_pubkey_file = config.get("experiment_control", 205 "ssh_pubkey_file") 206 self.ssh_privkey_file = config.get("experiment_control", 207 "ssh_privkey_file") 208 # NB for internal master/slave ops, not experiment setup 209 self.ssh_type = config.get("experiment_control", "sshkeytype", "rsa") 208 210 self.state = { } 209 211 self.state_lock = Lock() … … 234 236 if self.ssh_pubkey_file: 235 237 try: 238 print "reading %s" % self.ssh_pubkey_file 236 239 f = open(self.ssh_pubkey_file, 'r') 237 240 self.ssh_pubkey = f.read() … … 240 243 raise service_error(service_error.internal, 241 244 "Cannot read sshpubkey") 245 else: 246 raise service_error(service_error.internal, 247 "No SSH public key file?") 248 249 if not self.ssh_privkey_file: 250 raise service_error(service_error.internal, 251 "No SSH public key file?") 242 252 243 253 set_log_level(config, "experiment_control", self.log) … … 357 367 """ 358 368 359 scp_cmd = [self.scp_exec, file, "%s@%s:%s" % (user, host, dest)] 369 scp_cmd = [self.scp_exec, '-i', self.ssh_privkey_file, file, 370 "%s@%s:%s" % (user, host, dest)] 360 371 rv = 0 361 372 … … 378 389 only logged. 379 390 """ 380 sh_str = "%s %s@%s %s" % (self.ssh_exec, user, host, cmd) 391 sh_str = "%s -i %s %s@%s %s" % (self.ssh_exec, self.ssh_privkey_file, 392 user, host, cmd) 381 393 382 394 try: … … 802 814 "Unknown testbed: %s" % tb) 803 815 816 # currently this lumps all users into one service access group 817 service_keys = [ a for u in user \ 818 for a in u.get('access', []) \ 819 if a.has_key('sshPubkey')] 820 821 if len(service_keys) == 0: 822 raise service_error(service_error.req, 823 "Must have at least one SSH pubkey for services") 824 825 804 826 # The basic request 805 827 req = {\ … … 807 829 'user': user, 808 830 'allocID' : { 'localname': 'test' }, 809 # XXX: need to get service access stright810 831 'createAccess' : [ { 'sshPubkey' : self.ssh_pubkey } ], 811 'serviceAccess' : [ { 'sshPubkey' : self.ssh_pubkey } ]832 'serviceAccess' : service_keys 812 833 } 834 835 print "service %s" % service_keys 836 print "ssh pubkey %s" % self.ssh_pubkey 837 print "ssh pubkey file %s" % self.ssh_pubkey_file 813 838 814 839 if tb == master:
Note: See TracChangeset
for help on using the changeset viewer.