Compare commits

...

4 commits

Author SHA1 Message Date
Klaas Demter
cb958b6a17
Merge 889ca91b48 into dabaca4b70 2025-05-20 10:36:54 +00:00
Klaas Demter
889ca91b48 Fixes #462 notice permission denied on authorized_key module 2025-05-20 12:36:42 +02:00
softwarefactory-project-zuul[bot]
dabaca4b70
Merge pull request #640 from Klaas-/Klaas-fixCI
Remove EOL FreeBSD 13.2 from CI

SUMMARY

CI seems to be failing for a month, reason is that freebsd 13.2 is no longer valid.
See ansible-collections/community.general#8607

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
CI

Reviewed-by: Felix Fontein <felix@fontein.de>
Reviewed-by: Hideki Saito <saito@fgrep.org>
2025-05-20 00:22:19 +00:00
Klaas Demter
26b9b1438d Remove EOL FreeBSD 13.2 from CI 2025-05-19 18:10:38 +02:00
3 changed files with 15 additions and 14 deletions

View file

@ -237,8 +237,6 @@ stages:
test: rhel/8.8
- name: RHEL 9.2
test: rhel/9.2
- name: FreeBSD 13.2
test: freebsd/13.2
- stage: Remote_2_15
displayName: Remote 2.15
@ -254,8 +252,6 @@ stages:
test: rhel/8.7
- name: RHEL 9.1
test: rhel/9.1
- name: FreeBSD 13.2
test: freebsd/13.2
## Finally

View file

@ -0,0 +1,3 @@
---
bugfixes:
- ansible.posix.authorized_key - fixes error on permission denied in authorized_key module (https://github.com/ansible-collections/ansible.posix/issues/462).

View file

@ -225,6 +225,7 @@ import os.path
import tempfile
import re
import shlex
import errno
from operator import itemgetter
from ansible.module_utils._text import to_native
@ -475,16 +476,17 @@ def parsekey(module, raw_key, rank=None):
return (key, key_type, options, comment, rank)
def readfile(filename):
if not os.path.isfile(filename):
return ''
f = open(filename)
def readfile(module, filename):
try:
return f.read()
finally:
f.close()
with open(filename, 'r') as f:
return f.read()
except IOError as e:
if e.errno == errno.EACCES:
module.fail_json(msg="Permission denied on file or path for authorized keys file: {}".format(filename))
elif e.errno == errno.ENOENT:
return ''
else:
raise
def parsekeys(module, lines):
@ -597,7 +599,7 @@ def enforce_state(module, params):
# check current state -- just get the filename, don't create file
do_write = False
params["keyfile"] = keyfile(module, user, do_write, path, manage_dir)
existing_content = readfile(params["keyfile"])
existing_content = readfile(module, params["keyfile"])
existing_keys = parsekeys(module, existing_content)
# Add a place holder for keys that should exist in the state=present and