avoid index error on empty list, key being true means its not None nor [] fixes #13009
This commit is contained in:
parent
9ab42a98ca
commit
eae8942583
1 changed files with 2 additions and 2 deletions
|
@ -92,8 +92,8 @@ def enforce_state(module, params):
|
||||||
#Find the ssh-keygen binary
|
#Find the ssh-keygen binary
|
||||||
sshkeygen = module.get_bin_path("ssh-keygen",True)
|
sshkeygen = module.get_bin_path("ssh-keygen",True)
|
||||||
|
|
||||||
#trailing newline in files gets lost, so re-add if necessary
|
# Trailing newline in files gets lost, so re-add if necessary
|
||||||
if key is not None and key[-1]!='\n':
|
if key and key[-1] != '\n':
|
||||||
key+='\n'
|
key+='\n'
|
||||||
|
|
||||||
if key is None and state != "absent":
|
if key is None and state != "absent":
|
||||||
|
|
Loading…
Reference in a new issue