mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 23:25:28 +01:00
Merge 34b467719e into 12a1c25f5e
This commit is contained in:
commit
8e90713ec5
2 changed files with 5 additions and 2 deletions
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- sysctl - fix sysctl to work properly on symlinks (https://github.com/ansible-collections/ansible.posix/issues/111).
|
||||||
|
|
@ -366,7 +366,7 @@ class SysctlModule(object):
|
||||||
# Completely rewrite the sysctl file
|
# Completely rewrite the sysctl file
|
||||||
def write_sysctl(self):
|
def write_sysctl(self):
|
||||||
# open a tmp file
|
# 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")
|
f = open(tmp_path, "w")
|
||||||
try:
|
try:
|
||||||
for l in self.fixed_lines:
|
for l in self.fixed_lines:
|
||||||
|
|
@ -377,7 +377,7 @@ class SysctlModule(object):
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
# replace the real one
|
# 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))
|
||||||
|
|
||||||
|
|
||||||
# ==============================================================
|
# ==============================================================
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue