def test_smoke(self): with self.mocked_file(self._name, self._content): whitelist = WhiteList.from_file(self._name) self.assertEqual( repr(whitelist.inclusive_qualifier_list[0]), "<RegExpJobQualifier pattern:'^foo$'>") self.assertTrue(whitelist.designates(make_job('foo')))
def __init__(self, provider, config, ns): self.provider = provider self.config = config self.ns = ns if self.ns.whitelist: self.whitelist = WhiteList.from_file(self.ns.whitelist[0].name) elif self.config.whitelist is not Unset: self.whitelist = WhiteList.from_file(self.config.whitelist) else: self.whitelist = WhiteList.from_file(os.path.join( self.provider.whitelists_dir, "sru.whitelist")) self.job_list = self.provider.get_builtin_jobs() # XXX: maybe allow specifying system_id from command line? self.exporter = XMLSessionStateExporter(system_id=None) self.session = None self.runner = None
def __init__(self, provider, config, ns): self.provider = provider self.config = config self.ns = ns if self.ns.whitelist: self.whitelist = WhiteList.from_file(self.ns.whitelist[0].name) elif self.config.whitelist is not Unset: self.whitelist = WhiteList.from_file(self.config.whitelist) else: self.whitelist = WhiteList.from_file( os.path.join(self.provider.whitelists_dir, "sru.whitelist")) self.job_list = self.provider.get_builtin_jobs() # XXX: maybe allow specifying system_id from command line? self.exporter = XMLSessionStateExporter(system_id=None) self.session = None self.runner = None
def get_builtin_whitelists(self): logger.debug("Loading built-in whitelists...") whitelist_list = [] for name in os.listdir(self.whitelists_dir): if name.endswith(".whitelist"): whitelist_list.append( WhiteList.from_file(os.path.join( self.whitelists_dir, name))) return sorted(whitelist_list, key=lambda whitelist: whitelist.name)