summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Simon <dsimon@americancouncils.org>2013-05-09 21:35:05 +0200
committerDavid Simon <dsimon@americancouncils.org>2013-05-09 21:35:05 +0200
commit190ce16babb29b39af233c26b8408250b1fe5d34 (patch)
tree22c622da7e087d9658e740a2dc80c0f78b7481fb /test
parentDon't set PasswordAuthentication=no here because the connection plugin will d... (diff)
downloadansible-190ce16babb29b39af233c26b8408250b1fe5d34.tar.xz
ansible-190ce16babb29b39af233c26b8408250b1fe5d34.zip
Dealing with invalid symlinks and symlink permissions
Diffstat (limited to 'test')
-rw-r--r--test/TestRunner.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/TestRunner.py b/test/TestRunner.py
index 63f89dc3f3..cf17e66998 100644
--- a/test/TestRunner.py
+++ b/test/TestRunner.py
@@ -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):