Stop chdir() in pcre minions

This commit is contained in:
Thomas Jackson 2015-04-03 16:08:29 -07:00
parent f4a28a77f6
commit 2c89983424

View File

@ -141,12 +141,12 @@ class CkMinions(object):
''' '''
Return the minions found by looking via regular expressions Return the minions found by looking via regular expressions
''' '''
cwd = os.getcwd() try:
os.chdir(os.path.join(self.opts['pki_dir'], self.acc)) minions = os.listdir(os.path.join(self.opts['pki_dir'], self.acc))
reg = re.compile(expr) reg = re.compile(expr)
ret = [fn_ for fn_ in os.listdir('.') if reg.match(fn_)] return [m for m in minions if reg.match(m)]
os.chdir(cwd) except OSError:
return ret return []
def _check_cache_minions(self, def _check_cache_minions(self,
expr, expr,