fix absent key dir

This commit is contained in:
Mathieu Le Marec - Pasquet 2014-10-13 15:04:49 +02:00 committed by rallytime
parent a44bb73a2f
commit 9987bb7a97

View File

@ -547,9 +547,13 @@ class Key(object):
ret = {}
for dir_ in acc, pre, rej:
ret[os.path.basename(dir_)] = []
for fn_ in salt.utils.isorted(os.listdir(dir_)):
if os.path.isfile(os.path.join(dir_, fn_)):
ret[os.path.basename(dir_)].append(fn_)
try:
for fn_ in salt.utils.isorted(os.listdir(dir_)):
if os.path.isfile(os.path.join(dir_, fn_)):
ret[os.path.basename(dir_)].append(fn_)
except (OSError, IOError):
# key dir kind is not created yet, just skip
continue
return ret
def all_keys(self):