mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 23:44:00 -07:00
Dealing with invalid symlinks and symlink permissions
This commit is contained in:
parent
8ef18c2f98
commit
190ce16bab
2 changed files with 23 additions and 7 deletions
|
@ -230,6 +230,14 @@ class TestRunner(unittest.TestCase):
|
|||
assert self._run('file', ['dest=' + filedemo, 'state=absent'])['changed']
|
||||
assert not os.path.exists(filedemo)
|
||||
assert not self._run('file', ['dest=' + filedemo, 'state=absent'])['changed']
|
||||
|
||||
# Make sure that we can deal safely with bad symlinks
|
||||
os.symlink('/tmp/non_existent_target', filedemo)
|
||||
assert self._run('file', ['dest=' + tmp_dir, 'state=directory recurse=yes mode=701'])['changed']
|
||||
assert not self._run('file', ['dest=' + tmp_dir, 'state=directory', 'recurse=yes', 'owner=' + str(os.getuid())])['changed']
|
||||
assert os.path.islink(filedemo)
|
||||
assert self._run('file', ['dest=' + filedemo, 'state=absent'])['changed']
|
||||
assert not os.path.exists(filedemo)
|
||||
os.rmdir(tmp_dir)
|
||||
|
||||
def test_large_output(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue