mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Found a way how to have symlinks towards files without absolute paths in prefixes; fixed incorrect force setting on the hard links, which can not point to non-existing files
This commit is contained in:
parent
2b4688a0bd
commit
d3b544e842
1 changed files with 1 additions and 9 deletions
|
@ -149,7 +149,6 @@ def main():
|
||||||
original_basename = dict(required=False), # Internal use only, for recursive ops
|
original_basename = dict(required=False), # Internal use only, for recursive ops
|
||||||
recurse = dict(default='no', type='bool'),
|
recurse = dict(default='no', type='bool'),
|
||||||
force = dict(required=False,default=False,type='bool'),
|
force = dict(required=False,default=False,type='bool'),
|
||||||
chdir = dict(required=False,default=False),
|
|
||||||
diff_peek = dict(default=None),
|
diff_peek = dict(default=None),
|
||||||
validate = dict(required=False, default=None),
|
validate = dict(required=False, default=None),
|
||||||
),
|
),
|
||||||
|
@ -161,15 +160,8 @@ def main():
|
||||||
state = params['state']
|
state = params['state']
|
||||||
force = params['force']
|
force = params['force']
|
||||||
|
|
||||||
params['chdir'] = chdir = os.path.expanduser(params['chdir'])
|
|
||||||
params['path'] = path = os.path.expanduser(params['path'])
|
params['path'] = path = os.path.expanduser(params['path'])
|
||||||
|
|
||||||
if state == 'link' and chdir is not None and os.isdir(chdir):
|
|
||||||
os.chdir(chdir)
|
|
||||||
# catch exception permission deny, no directory, etc
|
|
||||||
# save current working directory, chdir to it at the end of the module
|
|
||||||
# or before any escape
|
|
||||||
|
|
||||||
# short-circuit for diff_peek
|
# short-circuit for diff_peek
|
||||||
if params.get('diff_peek', None) is not None:
|
if params.get('diff_peek', None) is not None:
|
||||||
appears_binary = False
|
appears_binary = False
|
||||||
|
@ -298,7 +290,7 @@ def main():
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="absolute paths are required")
|
module.fail_json(msg="absolute paths are required")
|
||||||
|
|
||||||
if not os.path.exists(abs_src) and not force:
|
if not os.path.exists(abs_src):
|
||||||
module.fail_json(path=path, src=src, msg='src file does not exist')
|
module.fail_json(path=path, src=src, msg='src file does not exist')
|
||||||
|
|
||||||
if prev_state == 'absent':
|
if prev_state == 'absent':
|
||||||
|
|
Loading…
Reference in a new issue