def parseConfFile(self): if not self.conf.has_section('sources'): self.conf.add_section('sources') configInfo = {} for c in Source.__subclasses__(): configInfo[c.getSourceName()] = c.getConfig(self.conf, "sources") if not self.conf.has_section('globals'): self.conf.add_section('globals') configInfo['globals'] = c.getConfig(self.conf, "globals") return configInfo
def __init__(self, configFile=False): home = os.path.dirname(sys.argv[0]) if (not configFile): configFile = "checkhosts.conf" self.files = [ os.path.join(home, configFile), "/etc/checkhosts.conf", os.path.join(os.getenv("HOME"), ".checkhosts.conf") ] self.defaults = {} for c in Source.__subclasses__(): self.mergeDefaults(c.getConfigDefaults()) self.conf = ConfigParser.SafeConfigParser(self.defaults) self.conf.read(self.files) self.conf.options = self.parseConfFile()
def __init__(self, configFile=False): home = os.path.dirname(sys.argv[0]) if (not configFile): configFile = "checkhosts.conf" self.files = [ os.path.join(home, configFile), "/etc/checkhosts.conf", os.path.join(os.getenv("HOME"), ".checkhosts.conf")] self.defaults = {} for c in Source.__subclasses__(): self.mergeDefaults(c.getConfigDefaults()) self.conf = ConfigParser.SafeConfigParser(self.defaults) self.conf.read(self.files) self.conf.options = self.parseConfFile()
def __init__(self, hostOpts, hostExprs, timeout, verbose): self.sources = {} self.filteredHosts = {} self.hostOpts = hostOpts if hostExprs and ',' in hostExprs: self.hostExprs = [h.strip() for h in hostExprs.split(',')] elif hostExprs: self.hostExprs = [hostExprs] else: self.hostExprs = None self.timeout = timeout self.verbose = verbose self.sourcesClasses = {} for c in Source.__subclasses__(): self.sourcesClasses[c.getSourceName()] = c self.filters = None