Making the error messages for bad key/dir permissions more understandable
Fixes #6254
This commit is contained in:
parent
efcf93f280
commit
a9000e7f3a
1 changed files with 2 additions and 2 deletions
|
@ -99,7 +99,7 @@ def key_for_hostname(hostname):
|
||||||
raise errors.AnsibleError('ACCELERATE_KEYS_DIR is not a directory.')
|
raise errors.AnsibleError('ACCELERATE_KEYS_DIR is not a directory.')
|
||||||
|
|
||||||
if stat.S_IMODE(os.stat(key_path).st_mode) != int(C.ACCELERATE_KEYS_DIR_PERMS, 8):
|
if stat.S_IMODE(os.stat(key_path).st_mode) != int(C.ACCELERATE_KEYS_DIR_PERMS, 8):
|
||||||
raise errors.AnsibleError('Incorrect permissions on ACCELERATE_KEYS_DIR (%s)' % (C.ACCELERATE_KEYS_DIR,))
|
raise errors.AnsibleError('Incorrect permissions on the private key directory. Use `chmod 0%o %s` to correct this issue, and make sure any of the keys files contained within that directory are set to 0%o' % (int(C.ACCELERATE_KEYS_DIR_PERMS, 8), C.ACCELERATE_KEYS_DIR, int(C.ACCELERATE_KEYS_FILE_PERMS, 8)))
|
||||||
|
|
||||||
key_path = os.path.join(key_path, hostname)
|
key_path = os.path.join(key_path, hostname)
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ def key_for_hostname(hostname):
|
||||||
return key
|
return key
|
||||||
else:
|
else:
|
||||||
if stat.S_IMODE(os.stat(key_path).st_mode) != int(C.ACCELERATE_KEYS_FILE_PERMS, 8):
|
if stat.S_IMODE(os.stat(key_path).st_mode) != int(C.ACCELERATE_KEYS_FILE_PERMS, 8):
|
||||||
raise errors.AnsibleError('Incorrect permissions on ACCELERATE_KEYS_FILE (%s)' % (key_path,))
|
raise errors.AnsibleError('Incorrect permissions on the key file for this host. Use `chmod 0%o %s` to correct this issue.' % (int(C.ACCELERATE_KEYS_FILE_PERMS, 8), key_path))
|
||||||
fh = open(key_path)
|
fh = open(key_path)
|
||||||
key = AesKey.Read(fh.read())
|
key = AesKey.Read(fh.read())
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
Loading…
Reference in a new issue