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
'''
cwd = os.getcwd()
os.chdir(os.path.join(self.opts['pki_dir'], self.acc))
try:
minions = os.listdir(os.path.join(self.opts['pki_dir'], self.acc))
reg = re.compile(expr)
ret = [fn_ for fn_ in os.listdir('.') if reg.match(fn_)]
os.chdir(cwd)
return ret
return [m for m in minions if reg.match(m)]
except OSError:
return []
def _check_cache_minions(self,
expr,