saltstack/salt — pull request #12962 by dr4Ke (2014-05-22 10:12:53+00:00)
Title: file.directory: fix cleaning directory symlinks

With a file.directory state, using the 'clean' directive, some symlinks
could not be removed, raising exception:
OSError: Cannot call rmtree on a symbolic link

The reason is that valid symlinks for directories are returned
by 'os.walk' as directories.

This commit checks if directories are, in fact, symlinks, and treats them
as simple files.

Note: I inverted files and dirs treatment blocks. I don't know if there was a reason for treating files before dirs.