Changeset 1b376ca for fedd/federation/allocate_project.py
- Timestamp:
- Dec 3, 2008 10:12:13 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- c8853fd
- Parents:
- dceeef9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/allocate_project.py
rdceeef9 r1b376ca 176 176 dir="/tmp") 177 177 178 if req.has_key('AllocateProjectRequestBody') and \ 179 req['AllocateProjectRequestBody'].has_key('project'): 180 proj = req['AllocateProjectRequestBody']['project'] 178 if req.has_key('AllocateProjectRequestBody'): 179 proj = req['AllocateProjectRequestBody'].get('project', None) 180 if not proj: 181 raise service_error(service_error.req, 182 "Badly formed allocation request") 183 resources = req['AllocateProjectRequestBody'].get('resources', { }) 181 184 else: 182 185 raise service_error(service_error.req, … … 279 282 ] 280 283 281 # Add commands to grant access to any resources in the request. 282 for nt in [ h for r in req.get('resources', []) \ 283 if r.has_key('node') and r['node'].has_key('hardware')\ 284 for h in r['node']['hardware'] ] : 285 cmds.append((self.wap, self.grantnodetype, '-p', name, nt)) 284 # Add commands to grant access to any resources in the request. The 285 # list comprehension pulls out the hardware types in the node entries 286 # in the resources list. 287 if resources.has_key('node'): 288 for nt in [ h for n in resources['node']\ 289 if n.has_key('hardware') for h in n['hardware'] ] : 290 if self.allocation_level >= self.confirm_keys: 291 cmds.append((self.wap, self.grantnodetype, '-p', pname, nt)) 292 286 293 287 294 # Create the projects … … 344 351 pname = req['StaticProjectRequestBody']['project']\ 345 352 ['name']['localname'] 346 resources = req['StaticProjectRequestBody'].get('resources', [])353 resources = req['StaticProjectRequestBody'].get('resources', { }) 347 354 except KeyError: 348 355 raise service_error(service_error.req, "Badly formed request") … … 370 377 # list comprehension pulls out the hardware types in the node entries 371 378 # in the resources list. 372 for nt in [ h for r in resources \373 if r.has_key('node') and r['node'].has_key('hardware')\374 for h in r['node']['hardware'] ] :375 376 cmds.append((self.wap, self.grantnodetype, '-p', pname, nt))379 if resources.has_key('node'): 380 for nt in [ h for n in resources['node']\ 381 if n.has_key('hardware') for h in n['hardware'] ] : 382 if self.allocation_level >= self.confirm_keys: 383 cmds.append((self.wap, self.grantnodetype, '-p', pname, nt)) 377 384 378 385 # Run the commands
Note: See TracChangeset
for help on using the changeset viewer.