raise exception if keyfile specified but does not exist

help user troubleshooting easier than return None
This commit is contained in:
Viet Hung Nguyen 2015-09-25 14:13:07 +07:00
parent 63c3cd396f
commit b5a45961e5

View File

@ -63,7 +63,7 @@ def _config(name, key=None, **kwargs):
def _get_keyring(keyfile):
keyring = None
if keyfile and __salt__['file.file_exists'](keyfile):
if keyfile:
with salt.utils.fopen(keyfile) as _f:
keyring = dns.tsigkeyring.from_text(json.load(_f))
return keyring