Ignore:
Timestamp:
Dec 9, 2009 3:53:14 PM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
c122b0c
Parents:
bde2217
Message:

getting the emulab structure out of the access commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    rbde2217 r4afcfc4  
    816816                    "Access denied by %s (%s)" % (tb, uri))
    817817
    818         if r.has_key('emulab'):
    819             e = r['emulab']
    820             p = e['project']
    821             tbparam[tb] = {
    822                     "boss": e['boss'],
    823                     "host": e['ops'],
    824                     "domain": e['domain'],
    825                     "fs": e['fileServer'],
    826                     "eventserver": e['eventServer'],
    827                     "project": unpack_id(p['name']),
    828                     "emulab" : e,
    829                     "allocID" : r['allocID'],
    830                     "uri": uri,
    831                     }
    832             # Make the testbed name be the label the user applied
    833             p['testbed'] = {'localname': tb }
    834 
    835             for u in p['user']:
    836                 role = u.get('role', None)
    837                 if role == 'experimentCreation':
    838                     tbparam[tb]['user'] = unpack_id(u['userID'])
    839                     break
    840             else:
    841                 raise service_error(service_error.internal,
    842                         "No createExperimentUser from %s" %tb)
    843             # Add attributes to parameter space.  We don't allow attributes to
    844             # overlay any parameters already installed.
    845             for a in e['fedAttr']:
    846                 try:
    847                     if a['attribute'] and \
    848                             isinstance(a['attribute'], basestring)\
    849                             and not tbparam[tb].has_key(a['attribute'].lower()):
    850                         tbparam[tb][a['attribute'].lower()] = a['value']
    851                 except KeyError:
    852                     self.log.error("Bad attribute in response: %s" % a)
    853         else:
    854             tbparam[tb] = {
     818        tbparam[tb] = {
    855819                "allocID" : r['allocID'],
    856820                "uri": uri,
    857             }
     821                }
     822
     823        # Add attributes to parameter space.  We don't allow attributes to
     824        # overlay any parameters already installed.
     825        for a in r['fedAttr']:
     826            try:
     827                if a['attribute'] and \
     828                        isinstance(a['attribute'], basestring)\
     829                        and not tbparam[tb].has_key(a['attribute'].lower()):
     830                    tbparam[tb][a['attribute'].lower()] = a['value']
     831            except KeyError:
     832                self.log.error("Bad attribute in response: %s" % a)
    858833
    859834    def release_access(self, tb, aid, uri=None):
     
    19891964        self.state_lock.acquire()
    19901965        if self.state.has_key(key):
     1966            self.state[key]['experimentStatus'] = "starting"
    19911967            for e in self.state[key].get('experimentID',[]):
    19921968                if not expid and e.has_key('fedid'):
Note: See TracChangeset for help on using the changeset viewer.