saltstack/salt — pull request #2668 by axiom (2012-11-22 11:45:56+00:00)
Title: Make remove in the file module also remove broken symlinks

The remove command in the file module had guard, `os.path.exists`, in front of all remove actions. That guard failed on broken symlinks, i.e. it returned `false` even though the broken symlink existed. Since the remove actions are properly guarded without the `os.path.exists` guard, this commits removes it. Now the remove command will also remove broken symlinks.

- - -

I'm a bit unsure of the tests written here, when I added `self.assertFalse(os.path.isfile(self.myfile))` as the last statement in the `test_remove_file` that assertion failed (similarly for the other test_remove tests). I don't believe such statements should fail, but I'm not very familiar with this so I'm assuming it is ok.

I also had some issues with my added tests for removing symlinks succeeded before I changed the actual code. I did not find that to be the case in "real" test cases though.