- Timestamp:
- Feb 13, 2010 2:42:32 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 94a00cb
- Parents:
- dac2316
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/emulab_access.py
rdac2316 rfe28bb2 71 71 self.userconfdir = config.get("access","userconfdir") 72 72 self.userconfcmd = config.get("access","userconfcmd") 73 self.userconfurl = config.get("access","userconfurl") 73 74 self.ssh_privkey_file = config.get("access","ssh_privkey_file") 74 75 self.ssh_pubkey_file = config.get("access","ssh_pubkey_file") … … 326 327 self.auth.set_attribute(o, fedid(hexstr=k)) 327 328 if self.allocation[k].has_key('userconfig'): 328 sfid = hexstr=self.allocation[k]['userconfig']329 sfid = self.allocation[k]['userconfig'] 329 330 fid = fedid(hexstr=sfid) 330 self.auth.set_attribute(fid, sfid)331 self.auth.set_attribute(fid, "/%s" % sfid) 331 332 332 333 … … 525 526 stdout=cf, stderr=dev_null, close_fds=True) 526 527 527 self.auth.set_attribute(confid, str(confid))528 self.auth.set_attribute(confid, "/%s" % str(confid)) 528 529 529 530 return confid, confcert … … 554 555 outs['server'] = "http://boss:7777" 555 556 elif sname == 'userconfig': 556 if self.userconfdir and self.userconfcmd: 557 if self.userconfdir and self.userconfcmd \ 558 and self.userconfurl: 557 559 cid, cert = self.export_userconf(project) 558 outs['server'] = "%s/%s" %(self.testbed, str(cid)) 560 outs['server'] = "%s/%s" % \ 561 (self.userconfurl, str(cid)) 559 562 outs['fedAttr'] = [ 560 563 { 'attribute': 'cert', 'value': cert }, … … 1148 1151 1149 1152 def StartSegment(self, req, fid): 1150 def get_url(url, cf, destdir ):1153 def get_url(url, cf, destdir, fn=None): 1151 1154 po = urlparse(url) 1152 fn = po.path.rpartition('/')[2] 1155 if not fn: 1156 fn = po.path.rpartition('/')[2] 1153 1157 try: 1154 1158 conn = httplib.HTTPSConnection(po.hostname, port=po.port, … … 1165 1169 lf.close() 1166 1170 except IOError, e: 1171 print e 1167 1172 raise service_error(service_error.internal, 1168 "Erro writing tempfile: %s" %e)1173 "Error writing tempfile: %s" %e) 1169 1174 except httplib.HTTPException, e: 1175 print e 1170 1176 raise service_error(service_error.internal, 1171 1177 "Error retrieving data: %s" % e) … … 1227 1233 if a['attribute'] == 'experiment_name': 1228 1234 ename = a['value'] 1235 1236 # If the userconf service was imported, collect the configuration 1237 # data. 1238 for s in services: 1239 if s.get("name", "") == 'userconfig' \ 1240 and s.get('visibility',"") == 'import': 1241 u = s.get('server', None) 1242 print "url %s" % u 1243 for a in s.get('fedAttr', []): 1244 if a.get('attribute',"") == 'cert': 1245 cert = a.get('value', None) 1246 break 1247 else: 1248 cert = None 1249 1250 if not cert: 1251 raise service_error(service_error.req, 1252 "No certificate for retreiving userconfig") 1253 try: 1254 tfos, tn = tempfile.mkstemp(suffix=".pem") 1255 tf = os.fdopen(tfos, 'w') 1256 print >>tf, cert 1257 tf.close() 1258 print "tn %s" % tn 1259 get_url(u, tn, tmpdir, "userconf") 1260 except IOError, e: 1261 raise service_error(service.error.internal, 1262 "Cannot create temp file for " + 1263 "userconfig certificates: %s e") 1264 finally: 1265 if tn: os.remove(tn) 1266 break 1267 1268 1229 1269 1230 1270 proj = None
Note: See TracChangeset
for help on using the changeset viewer.