Changeset 45e880d for fedd


Ignore:
Timestamp:
Nov 23, 2011 2:47:06 PM (12 years ago)
Author:
Ted Faber <faber@…>
Branches:
compt_changes, info-ops, master
Children:
6e33086
Parents:
c6f867c
Message:

More initial info edits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    rc6f867c r45e880d  
    11991199        stopper(self, user, proj, ename, gid, nonce)
    12001200        return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
     1201
     1202    def InfoSegment(self, req, fid):
     1203        try:
     1204            req = req['InfoSegmentRequestBody']
     1205        except KeyError:
     1206            raise service_error(server_error.req, "Badly formed request")
     1207
     1208        auth_attr = req['allocID']['fedid']
     1209        aid = "%s" % auth_attr
     1210
     1211        access_ok, proof = self.auth.check_attribute(fid, auth_attr,
     1212                with_proof=True)
     1213        if not access_ok:
     1214            raise service_error(service_error.access, "Access denied")
     1215
     1216        self.state_lock.acquire()
     1217        if aid in self.allocation:
     1218            topo = self.allocation[aid].get('topo', None)
     1219            if topo: topo = topo.clone()
     1220            proj = self.allocation[aid].get('project', None)
     1221            if not proj:
     1222                proj = self.allocation[aid].get('sproject', None)
     1223            user = self.allocation[aid].get('user', None)
     1224            ename = self.allocation[aid].get('experiment', None)
     1225            nonce = self.allocation[aid].get('nonce', False)
     1226        else:
     1227            proj = None
     1228            user = None
     1229            ename = None
     1230            nonce = False
     1231        self.state_lock.release()
     1232
     1233        if not proj:
     1234            raise service_error(service_error.internal,
     1235                    "Can't find project for %s" % aid)
     1236        else:
     1237            if '/' in proj: proj, gid = proj.split('/')
     1238            else: gid = None
     1239
     1240        if not user:
     1241            raise service_error(service_error.internal,
     1242                    "Can't find creation user for %s" % aid)
     1243        if not ename:
     1244            raise service_error(service_error.internal,
     1245                    "Can't find experiment name for %s" % aid)
     1246        info = self.info_segment(keyfile=self.ssh_privkey_file,
     1247                debug=self.create_debug, boss=self.boss, cert=self.xmlrpc_cert)
     1248        info(self, user, proj, ename, gid, nonce)
     1249        return {
     1250                'allocID': req['allocID'],
     1251                'experimentdescription' { 'topdldescription' : topo.to_dict() },
     1252                'proof': proof.to_dict(),
     1253                }
     1254
Note: See TracChangeset for help on using the changeset viewer.