Changeset 2c36179 for fedd/federation
- Timestamp:
- Jul 8, 2012 7:42:35 AM (12 years ago)
- Branches:
- compt_changes, master
- Children:
- b15ecc6
- Parents:
- b931822
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/authorizer.py
rb931822 r2c36179 201 201 """ 202 202 203 clean_attr_re = re.compile('[^A-Za-z0-9_ ]+')203 clean_attr_re = re.compile('[^A-Za-z0-9_:]+') 204 204 clean_prefix_attr_re = re.compile('^_+') 205 205 cred_file_re = re.compile('.*\.der$') … … 657 657 def update(self): 658 658 rv = False 659 if update_dir is None: return True 659 if self.update_dir is None or not os.path.isdir(self.update_dir): 660 return True 660 661 lf = None 661 662 files = [] 662 663 try: 663 lf = open('%s/lock' % self.update_dir, ' r')664 lf = open('%s/lock' % self.update_dir, 'w') 664 665 except EnvironmentError, e: 665 666 return rv 666 667 try: 667 668 fcntl.flock(lf, fcntl.LOCK_EX) 668 files = os.listdir(update_dir) 669 files = [os.path.join(self.update_dir, fn) \ 670 for fn in os.listdir(self.update_dir) \ 671 if fn != 'lock'] 669 672 rv = self.import_credentials(file_list=files) 670 673 try: … … 676 679 rv = True 677 680 finally: 678 fcntl.flock( fl, fcntl.LOCK_UN)681 fcntl.flock(lf, fcntl.LOCK_UN) 679 682 return rv 680 683
Note: See TracChangeset
for help on using the changeset viewer.