- Timestamp:
- May 28, 2010 10:10:58 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 623a2c9
- Parents:
- 6abed7b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/emulab_access.py
r6abed7b ra20a20f 107 107 if config.has_option("access", "accessdb"): 108 108 self.read_access(config.get("access", "accessdb")) 109 110 if not self.local_seer_image or not self.local_seer_software:111 self.exports.discard('local_seer_control')112 self.exports.discard('seer_master')113 114 if not self.local_seer_start:115 self.exports.discard('local_seer_control')116 117 if not self.seer_master_start:118 self.exports.discard('seer_master')119 120 109 tb = config.get('access', 'testbed') 121 110 if tb: self.testbed = [ t.strip() for t in tb.split(',') ] … … 146 135 self.auth.set_attribute(fid, "/%s" % sfid) 147 136 self.state_lock.release() 137 self.exports = { 138 'SMB': self.export_SMB, 139 'seer': self.export_seer, 140 'tmcd': self.export_tmcd, 141 'userconfig': self.export_userconfig, 142 'project_export': self.export_project_export, 143 'local_seer_control': self.export_local_seer, 144 'seer_master': self.export_seer_master, 145 'hide_hosts': self.export_hide_hosts, 146 } 147 148 if not self.local_seer_image or not self.local_seer_software or \ 149 not self.local_seer_start: 150 if 'local_seer_control' in self.exports: 151 del self.exports['local_seer_control'] 152 153 if not self.local_seer_image or not self.local_seer_software or \ 154 not self.seer_master_start: 155 if 'seer_master' in self.exports: 156 del self.exports['seer_master'] 148 157 149 158 … … 760 769 continue 761 770 762 763 def configure_userconf(self, services, tmpdir):764 """765 If the userconf service was imported, collect the configuration data.766 """767 for s in services:768 s_name = s.get('name', '')769 s_vis = s.get('visibility','')770 if s_name == 'userconfig' and s_vis == 'import':771 # Collect ther server and certificate info.772 u = s.get('server', None)773 for a in s.get('fedAttr', []):774 if a.get('attribute',"") == 'cert':775 cert = a.get('value', None)776 break777 else:778 cert = None779 780 if cert:781 # Make a temporary certificate file for get_url. The782 # finally clause removes it whether something goes783 # wrong (including an exception from get_url) or not.784 try:785 tfos, tn = tempfile.mkstemp(suffix=".pem")786 tf = os.fdopen(tfos, 'w')787 print >>tf, cert788 tf.close()789 self.log.debug("Getting userconf info: %s" % u)790 get_url(u, tn, tmpdir, "userconf")791 self.log.debug("Got userconf info: %s" % u)792 except EnvironmentError, e:793 raise service_error(service.error.internal,794 "Cannot create temp file for " +795 "userconfig certificates: %s" % e)796 except:797 t, v, st = sys.exc_info()798 raise service_error(service_error.internal,799 "Error retrieving %s: %s" % (u, v))800 finally:801 if tn: os.remove(tn)802 else:803 raise service_error(service_error.req,804 "No certificate for retreiving userconfig")805 break806 807 771 def add_seer_node(self, topo, name, startup): 808 772 """ … … 1005 969 self.state_lock.release() 1006 970 return retval 1007 1008 def remove_dirs(self, dir):1009 """1010 Remove the directory tree and all files rooted at dir. Log any errors,1011 but continue.1012 """1013 self.log.debug("[removedirs]: removing %s" % dir)1014 try:1015 for path, dirs, files in os.walk(dir, topdown=False):1016 for f in files:1017 os.remove(os.path.join(path, f))1018 for d in dirs:1019 os.rmdir(os.path.join(path, d))1020 os.rmdir(dir)1021 except EnvironmentError, e:1022 self.log.error("Error deleting directory tree in %s" % e);1023 971 1024 972 # End of StartSegment support routines
Note: See TracChangeset
for help on using the changeset viewer.