[PR #8925/7c913b23 backport][stable-8] Pass absolute paths to atomic_move() (#8958)
Pass absolute paths to atomic_move() (#8925)
Pass absolute paths to atmoic_move().
(cherry picked from commit 7c913b239a
)
Co-authored-by: Felix Fontein <felix@fontein.de>
pull/8976/head
parent
086b403336
commit
715e6706cc
|
@ -0,0 +1,6 @@
|
|||
bugfixes:
|
||||
- "ini_file - pass absolute paths to ``module.atomic_move()`` (https://github.com/ansible/ansible/issues/83950, https://github.com/ansible-collections/community.general/pull/8925)."
|
||||
- "java_keystore - pass absolute paths to ``module.atomic_move()`` (https://github.com/ansible/ansible/issues/83950, https://github.com/ansible-collections/community.general/pull/8925)."
|
||||
- "jenkins_plugin - pass absolute paths to ``module.atomic_move()`` (https://github.com/ansible/ansible/issues/83950, https://github.com/ansible-collections/community.general/pull/8925)."
|
||||
- "kdeconfig - pass absolute paths to ``module.atomic_move()`` (https://github.com/ansible/ansible/issues/83950, https://github.com/ansible-collections/community.general/pull/8925)."
|
||||
- "pam_limits - pass absolute paths to ``module.atomic_move()`` (https://github.com/ansible/ansible/issues/83950, https://github.com/ansible-collections/community.general/pull/8925)."
|
|
@ -569,7 +569,7 @@ def do_ini(module, filename, section=None, section_has_values=None, option=None,
|
|||
module.fail_json(msg="Unable to create temporary file %s", traceback=traceback.format_exc())
|
||||
|
||||
try:
|
||||
module.atomic_move(tmpfile, target_filename)
|
||||
module.atomic_move(tmpfile, os.path.abspath(target_filename))
|
||||
except IOError:
|
||||
module.ansible.fail_json(msg='Unable to move temporary \
|
||||
file %s to %s, IOError' % (tmpfile, target_filename), traceback=traceback.format_exc())
|
||||
|
|
|
@ -470,7 +470,7 @@ class JavaKeystore:
|
|||
|
||||
if self.keystore_type == 'pkcs12':
|
||||
# Preserve properties of the destination file, if any.
|
||||
self.module.atomic_move(keystore_p12_path, self.keystore_path)
|
||||
self.module.atomic_move(os.path.abspath(keystore_p12_path), os.path.abspath(self.keystore_path))
|
||||
self.update_permissions()
|
||||
self.result['changed'] = True
|
||||
return self.result
|
||||
|
|
|
@ -685,7 +685,7 @@ class JenkinsPlugin(object):
|
|||
|
||||
# Move the updates file to the right place if we could read it
|
||||
if tmp_updates_file != updates_file:
|
||||
self.module.atomic_move(tmp_updates_file, updates_file)
|
||||
self.module.atomic_move(os.path.abspath(tmp_updates_file), os.path.abspath(updates_file))
|
||||
|
||||
# Check if we have the plugin data available
|
||||
if not data.get('plugins', {}).get(self.params['name']):
|
||||
|
@ -718,7 +718,7 @@ class JenkinsPlugin(object):
|
|||
details=to_native(e))
|
||||
|
||||
# Move the file onto the right place
|
||||
self.module.atomic_move(tmp_f, f)
|
||||
self.module.atomic_move(os.path.abspath(tmp_f), os.path.abspath(f))
|
||||
|
||||
def uninstall(self):
|
||||
changed = False
|
||||
|
|
|
@ -214,7 +214,7 @@ def run_module(module, tmpdir, kwriteconfig):
|
|||
if module.params['backup'] and os.path.exists(b_path):
|
||||
result['backup_file'] = module.backup_local(result['path'])
|
||||
try:
|
||||
module.atomic_move(b_tmpfile, b_path)
|
||||
module.atomic_move(b_tmpfile, os.path.abspath(b_path))
|
||||
except IOError:
|
||||
module.ansible.fail_json(msg='Unable to move temporary file %s to %s, IOError' % (tmpfile, result['path']), traceback=traceback.format_exc())
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ def main():
|
|||
pass
|
||||
|
||||
# Move tempfile to newfile
|
||||
module.atomic_move(nf.name, limits_conf)
|
||||
module.atomic_move(os.path.abspath(nf.name), os.path.abspath(limits_conf))
|
||||
|
||||
try:
|
||||
nf.close()
|
||||
|
|
Loading…
Reference in New Issue