Changeset 9294673 for fedd/federation/experiment_control.py
- Timestamp:
- Nov 21, 2011 5:33:41 PM (12 years ago)
- Branches:
- compt_changes, info-ops, master
- Children:
- f769cb3
- Parents:
- 80b1e82
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/experiment_control.py
r80b1e82 r9294673 960 960 tb_attrs = copy.copy(attrs) 961 961 tp.wait_for_slot() 962 uri = tbparams[tb]. get('uri', tbmap.get(testbed_base(tb), None))962 uri = tbparams[tb].uri or tbmap.get(testbed_base(tb), None) 963 963 base, suffix = split_testbed(tb) 964 964 if suffix: … … 971 971 "Unknown testbed %s !?" % tb) 972 972 973 if tbparams[tb].has_key('allocID') and \ 974 tbparams[tb]['allocID'].has_key('fedid'): 975 aid = tbparams[tb]['allocID']['fedid'] 976 else: 973 aid = tbparams[tb].allocID 974 if not aid: 977 975 raise service_error(service_error.internal, 978 976 "No alloc id for testbed %s !?" % tb) … … 1021 1019 # Create and start a thread to stop the segment 1022 1020 tp.wait_for_slot() 1023 uri = tbparams[tb] ['uri']1021 uri = tbparams[tb].uri 1024 1022 t = pooled_thread(\ 1025 1023 target=self.terminate_segment(log=log, … … 1029 1027 trusted_certs=self.trusted_certs, 1030 1028 caller=self.call_TerminateSegment), 1031 args=(uri, tbparams[tb] ['federant']['allocID']),1029 args=(uri, tbparams[tb].allocID), 1032 1030 name=tb, 1033 1031 pdata=tp, trace_file=self.trace_file) … … 1040 1038 for tb in tbparams.keys(): 1041 1039 try: 1042 self.release_access(tb, tbparams[tb] ['allocID'],1043 tbmap=tbmap, uri=tbparams[tb]. get('uri', None),1040 self.release_access(tb, tbparams[tb].allocID, 1041 tbmap=tbmap, uri=tbparams[tb].uri, 1044 1042 cert_file=cert, cert_pwd=pw) 1045 1043 except service_error, e: … … 1386 1384 "Bad access response (no access proof)") 1387 1385 1388 tbparam[tb] = { 1389 "allocID" : r['allocID'], 1390 "uri": uri, 1391 "proof": [ r['proof'] ], 1392 } 1386 tbparam[tb] = allocation_info(allocID=r['allocID'].get('fedid', None), 1387 tb=tb, uri=uri, proof=[r['proof']]) 1393 1388 1394 1389 # Collect the responses corresponding to the services this testbed … … 1405 1400 for a in r.get('fedAttr', []): 1406 1401 try: 1407 if a['attribute'] and \ 1408 isinstance(a['attribute'], basestring)\ 1409 and not tbparam[tb].has_key(a['attribute'].lower()): 1410 tbparam[tb][a['attribute'].lower()] = a['value'] 1402 if a['attribute']: 1403 tbparam[tb].set_attribute(a['attribute'], a['value']) 1411 1404 except KeyError: 1412 1405 self.log.error("Bad attribute in response: %s" % a) … … 1525 1518 # the loop. 1526 1519 auth_attrs.update([ 1527 (tbparams[tb] ['allocID']['fedid'], "/%s/%s" % ( path, dest)) \1520 (tbparams[tb].allocID, "/%s/%s" % ( path, dest)) \ 1528 1521 for tb in tbparams.keys()]) 1529 1522 … … 1829 1822 # allocation principal. Yeah, that's a long list comprehension. 1830 1823 self.append_experiment_authorization(expid, set([ 1831 (tbparams[tb] ['allocID']['fedid'], "%s/%s" % (configpath, f)) \1824 (tbparams[tb].allocID, "%s/%s" % (configpath, f)) \ 1832 1825 for tb in tbparams.keys() \ 1833 1826 for f in ("hosts", 'ca.pem', 'node.pem', … … 1982 1975 # save federant information 1983 1976 for k in allocated.keys(): 1984 exp.add_allocation( 1985 allocation_info( 1986 tb=k, 1987 allocID=tbparams[k]['allocID'].get('fedid', None), 1988 uri=tbparams[k]['uri'], 1989 proof=tbparams[k]['proof']) 1990 ) 1977 exp.add_allocation(tbparams[k]) 1991 1978 1992 1979 # Access proofs for the response message 1993 1980 proofs = [copy.deepcopy(p) for k in tbparams.keys()\ 1994 for p in tbparams[k] ['proof']]1981 for p in tbparams[k].proof] 1995 1982 if self.state_filename: 1996 1983 self.write_state() … … 2105 2092 if store_keys: 2106 2093 auth_attrs.update(set([ 2107 (tbparams[tb] ['allocID']['fedid'], sk) \2094 (tbparams[tb].allocID, sk) \ 2108 2095 for sk in store_keys.split(" ")])) 2109 2096
Note: See TracChangeset
for help on using the changeset viewer.