Changeset d064566
- Timestamp:
- Jul 7, 2012 5:39:23 PM (12 years ago)
- Branches:
- compt_changes, master
- Children:
- e062282
- Parents:
- d58ee5e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/authorizer.py
rd58ee5e rd064566 21 21 import os, os.path 22 22 import re 23 import fcntl 23 24 24 25 class authorizer_base: … … 208 209 class bad_cert_error(RuntimeError): pass 209 210 210 def __init__(self, certs=None, me=None, key=None, load=None, save=None): 211 def __init__(self, certs=None, me=None, key=None, load=None, save=None, 212 update=None): 211 213 self.creddy_id = None 212 214 self.globals = set() … … 215 217 self.save_dir = load or save 216 218 self.local_files = False 219 self.update_dir = os.path.abspath(update) 217 220 if self.save_dir: 218 221 self.save_dir = os.path.abspath(self.save_dir) … … 648 651 return found 649 652 653 def update(self): 654 rv = False 655 if update_dir is None: return True 656 lf = None 657 files = [] 658 try: 659 lf = open('%s/lock' % self.update_dir, 'r') 660 except EnvironmentError, e: 661 return rv 662 try: 663 fcntl.flock(lf, fcntl.LOCK_EX) 664 files = os.listdir(update_dir) 665 rv = self.import_credentials(file_list=files) 666 try: 667 for fn in files: 668 os.remove(fn) 669 except EnvironmentError, e: 670 # failure to clear the update directory is no biggie 671 pass 672 rv = True 673 finally: 674 fcntl.flock(fl, fcntl.LOCK_UN) 675 return rv 676 677 678 679 650 680 def __str__(self): 651 681
Note: See TracChangeset
for help on using the changeset viewer.