File.recurse problem "Cannot call rmtree on a symbolic link"

1,008 views
Skip to first unread message

Robert Parker

unread,
May 16, 2014, 3:34:46 PM5/16/14
to salt-...@googlegroups.com
I'm syncing a directory between my salt master and one of my minions.  This is salt 2014.1.3 on CentOS 6.4.  The basic formula goes:

/data/webdir:
  file.recurse:
    - source: salt://files/mywebdir
    - user: apache
    - group: apache
    - dir_mode: 755
    - makedirs: True
    - clean: True
    - include_empty: True

Recently, I've been getting this error which I wasn't getting under 2014.1.0:

----------
          ID: /data/webdir
    Function: file.recurse
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.6/site-packages/salt/state.py", line 1378, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.6/site-packages/salt/states/file.py", line 1936, in recurse
                  removed = _clean_dir(name, list(keep), exclude_pat)
                File "/usr/lib/python2.6/site-packages/salt/states/file.py", line 338, in _clean_dir
                  shutil.rmtree(nfn)
                File "/usr/lib64/python2.6/shutil.py", line 197, in rmtree
                  onerror(os.path.islink, path, sys.exc_info())
                File "/usr/lib64/python2.6/shutil.py", line 195, in rmtree
                  raise OSError("Cannot call rmtree on a symbolic link")
              OSError: Cannot call rmtree on a symbolic link
     Changes:   
----------

Its apparently having trouble deleting directories with symlinks in order to enforce "clean: True", but even when I add "force_symlinks: True", I get the same error.

Anyone else seeing this?  I'm not getting much info on this from web searches.


Robert Parker

unread,
May 16, 2014, 4:11:38 PM5/16/14
to salt-...@googlegroups.com
I had a symlink at /data/webdir/foo that pointed to a directory on a completely different filesystem on the local minion.  When I deleted that symlink, things worked fine.  The behavior I expect with "clean: True" is that if the symlink doesnt exist on the source, it gets deleted, regardless of whether its a file or directory symlink.

Colton Myers

unread,
May 19, 2014, 6:35:25 PM5/19/14
to salt-...@googlegroups.com
Can you please create an issue on Github?  We'll investigate and get this fixed.

--
Colton Myers


--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages