def getConfig(self): """ get updated configuration from the Factory Config plugins """ newqcl = Config() for config_plugin in self.factory.config_plugins: tmpqcl = config_plugin.getConfig() newqcl.merge(tmpqcl) return newqcl
def getAuthConfig(self): """ get updated configuration from the Factory Config/Auth plugins """ self.log.debug('starting') newconfig = Config() for config_plugin in self.factory.auth_config_plugins: tmpconfig = config_plugin.getConfig() newconfig.merge(tmpconfig) self.log.debug('leaving with newconf = %s with %s sections.' % ( newconfig, len(newconfig.sections()))) return newconfig
def getConfigWMSQueue(self, wmsqueue): """ get the config sections only for a given wmsqueue """ conf = self.getConfig() out = Config() for section_name in conf.sections(): section = conf.getSection(section_name) if section.get(section_name, 'wmsqueue') == wmsqueue: out.merge(section) return out
def getConfigWMSQueue(self, wmsqueue): """ get the config sections only for a given wmsqueue """ conf = self.getConfig() out = Config() for section_name in conf.sections(): section = conf.getSection(section_name) if section.get(section_name, 'wmsqueue') == wmsqueue: out.merge(section) return out
def _createConfig(self): ''' Creates and sets self.currentconfig and self.stringconfig as configured by files. ''' td = datetime.datetime.now() - self.lastconfigupdate totalseconds = td.seconds + (td.days * 24 * 3600) if totalseconds > self.sleep: self.log.debug("Configs older than %s seconds. Re-creating..." % self.sleep) self._filter() cp = Config() sc = '' # New string config. for i in range(len(self.activities)): tmpcp = Config() vo = self.vos[i] cloud = self.clouds[i] activity = self.activities[i] default = self.defaultsfiles[i] pilotmgr = self.pilotmanager[i] if default is not None: tmpfile = open(default) tmpcp.readfp(tmpfile) tmpfile.seek(0) # to read the file over again for line in tmpfile.readlines(): sc += line for q in self.currentinfo: if q.vo_name == vo and\ q.cloud == cloud and\ q.type == activity and\ q.pilot_manager == pilotmgr : for cq in q.ce_queues: try: qc = cq.getAPFConfig() tmpcp.merge(qc) # add content of Config object to the string representation sc += "\n" sc += qc.getContent() except Exception as e: self.log.error('Captured exception %s' % e) cp.merge(tmpcp) self.currentconfig = cp self.stringconfig = sc else: self.log.debug("Configs up to date.")
def _createConfig(self): ''' Creates and sets self.currentconfig and self.stringconfig as configured by files. ''' td = datetime.datetime.now() - self.lastconfigupdate totalseconds = td.seconds + ( td.days * 24 * 3600) if totalseconds > self.sleep: self.log.debug("Configs older than %s seconds. Re-creating..." % self.sleep) self._filter() cp = Config() sc = '' # New string config. for i in range(len(self.activities)): tmpcp = Config() vo = self.vos[i] cloud = self.clouds[i] activity = self.activities[i] default = self.defaultsfiles[i] pilotmgr = self.pilotmanager[i] if default is not None: tmpfile = open(default) tmpcp.readfp(tmpfile) tmpfile.seek(0) # to read the file over again for line in tmpfile.readlines(): sc += line for q in self.currentinfo: if q.vo_name == vo and\ q.cloud == cloud and\ q.type == activity and\ q.pilot_manager == pilotmgr : for cq in q.ce_queues: try: qc = cq.getAPFConfig() tmpcp.merge(qc) # add content of Config object to the string representation sc += "\n" sc += qc.getContent() except Exception as e: self.log.error('Captured exception %s' % e) cp.merge(tmpcp) self.currentconfig = cp self.stringconfig = sc else: self.log.debug("Configs up to date.")