mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #923 from dagwieers/special-file
Handle special files just like normal files
This commit is contained in:
commit
1ca6335323
1 changed files with 6 additions and 6 deletions
12
library/file
12
library/file
|
@ -39,10 +39,10 @@ def add_path_info(kwargs):
|
||||||
# secontext not yet supported
|
# secontext not yet supported
|
||||||
if os.path.islink(path):
|
if os.path.islink(path):
|
||||||
kwargs['state'] = 'link'
|
kwargs['state'] = 'link'
|
||||||
elif os.path.isfile(path):
|
elif os.path.isdir(path):
|
||||||
kwargs['state'] = 'file'
|
|
||||||
else:
|
|
||||||
kwargs['state'] = 'directory'
|
kwargs['state'] = 'directory'
|
||||||
|
else:
|
||||||
|
kwargs['state'] = 'file'
|
||||||
if HAVE_SELINUX and selinux_enabled():
|
if HAVE_SELINUX and selinux_enabled():
|
||||||
kwargs['secontext'] = ':'.join(selinux_context(path))
|
kwargs['secontext'] = ':'.join(selinux_context(path))
|
||||||
else:
|
else:
|
||||||
|
@ -270,10 +270,10 @@ def main():
|
||||||
if os.path.lexists(path):
|
if os.path.lexists(path):
|
||||||
if os.path.islink(path):
|
if os.path.islink(path):
|
||||||
prev_state = 'link'
|
prev_state = 'link'
|
||||||
elif os.path.isfile(path):
|
elif os.path.isdir(path):
|
||||||
prev_state = 'file'
|
|
||||||
else:
|
|
||||||
prev_state = 'directory'
|
prev_state = 'directory'
|
||||||
|
else:
|
||||||
|
prev_state = 'file'
|
||||||
|
|
||||||
if prev_state != 'absent' and state == 'absent':
|
if prev_state != 'absent' and state == 'absent':
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue