Compare commits

...

6 commits

Author SHA1 Message Date
Sato Kenta
8e90713ec5
Merge 34b467719e into 12a1c25f5e 2023-07-07 23:19:14 +01:00
satken2
34b467719e sysctl: Fixed sysctl to work on symlinks(#111) 2021-06-12 01:03:28 +09:00
satken2
a488709313 sysctl: Fixed sysctl to work on symlinks(#111) 2021-06-12 00:33:39 +09:00
satken2
c9747fd243 sysctl: Fixed sysctl to work on symlinks(#111) 2021-06-12 00:33:20 +09:00
satken2
3d7334dcfc sysctl: Fixed sysctl to work on symlinks(#111) 2021-06-11 23:57:09 +09:00
satken2
42c4c192d4 sysctl: Fixed sysctl to work on symlinks(#111) 2021-06-10 23:42:18 +09:00
2 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- sysctl - fix sysctl to work properly on symlinks (https://github.com/ansible-collections/ansible.posix/issues/111).

View file

@ -366,7 +366,7 @@ class SysctlModule(object):
# Completely rewrite the sysctl file
def write_sysctl(self):
# open a tmp file
fd, tmp_path = tempfile.mkstemp('.conf', '.ansible_m_sysctl_', os.path.dirname(self.sysctl_file))
fd, tmp_path = tempfile.mkstemp('.conf', '.ansible_m_sysctl_', os.path.dirname(os.path.realpath(self.sysctl_file)))
f = open(tmp_path, "w")
try:
for l in self.fixed_lines:
@ -377,7 +377,7 @@ class SysctlModule(object):
f.close()
# replace the real one
self.module.atomic_move(tmp_path, self.sysctl_file)
self.module.atomic_move(tmp_path, os.path.realpath(self.sysctl_file))
# ==============================================================