Changeset 25bf6cc for fedd/federation
- Timestamp:
- Jul 8, 2012 7:43:41 AM (12 years ago)
- Branches:
- compt_changes, master
- Children:
- df35876
- Parents:
- b15ecc6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/experiment_control.py
rb15ecc6 r25bf6cc 13 13 import signal 14 14 import time 15 import shutil 16 import zipfile 15 17 16 18 import os.path … … 125 127 self.store_url = config.get("experiment_control", "store_url") 126 128 self.splitter_url = config.get("experiment_control", "ns2topdl_uri") 129 self.grouper_url = config.get("experiment_control", "grouper_url") 127 130 self.fedkit = parse_tarfile_list(\ 128 131 config.get("experiment_control", "fedkit")) … … 183 186 self.get_access = self.legacy_get_access 184 187 elif self.auth_type == 'abac': 185 self.auth = abac_authorizer(load=self.auth_dir) 188 self.auth = abac_authorizer(load=self.auth_dir, 189 update=os.path.join(self.auth_dir,'update')) 186 190 else: 187 191 raise service_error(service_error.internal, … … 394 398 except TypeError, e: 395 399 self.log.error("Pickling problem (TypeError): %s" % e) 400 401 # XXX this may belong somewhere else 402 403 def get_grouper_updates(self, fid): 404 if self.grouper_url is None: return 405 d = tempfile.mkdtemp() 406 try: 407 fstr = "%s" % fid 408 # XXX locking 409 zipname = os.path.join(d, 'grouper.zip') 410 dest = os.path.join(self.auth_dir, 'update') 411 resp = urlopen('%s?uid=%s' % (self.grouper_url, fstr)) 412 f = open(zipname, 'w') 413 f.write(resp.read()) 414 f.close() 415 zf = zipfile.ZipFile(zipname, 'r') 416 zf.extractall(dest) 417 zf.close() 418 finally: 419 shutil.rmtree(d) 396 420 397 421 … … 1622 1646 if not self.auth.import_credentials(data_list=req.get('credential', [])): 1623 1647 self.log.debug("Failed to import delegation credentials(!)") 1648 self.get_grouper_updates(fid) 1649 self.auth.update() 1624 1650 self.auth.save() 1625 1651 … … 2122 2148 # Import information from the requester 2123 2149 # import may partially succeed so always save credentials and warn 2124 if not self.auth.import_credentials(data_list=req.get('credential', 2150 if not self.auth.import_credentials(data_list=req.get('credential',[])): 2125 2151 self.log.debug("Failed to import delegation credentials(!)") 2152 self.get_grouper_updates(fid) 2153 self.auth.update() 2126 2154 self.auth.save() 2127 2155 … … 2563 2591 2564 2592 self.log.info("Multi Info call started for %s" % fid) 2593 self.get_grouper_updates(fid) 2594 self.auth.update() 2595 self.auth.save() 2565 2596 self.state_lock.acquire() 2566 2597 for key in [ k for k in self.state.keys() if isinstance(k, fedid)]:
Note: See TracChangeset
for help on using the changeset viewer.