salt icon indicating copy to clipboard operation
salt copied to clipboard

Windows file.managed broken

Open joshFive opened this issue 12 years ago • 6 comments

Similar issue to that in the past, possible regression. Minion is Win2k8 R2 v.0.17.4, Master is Debian v.0.17.5

salt 'render*' state.sls qaex.sectran.render test=True
init.sls - 
 file.managed:
    - name: d:\Apps\jboss\server\default\conf\jboss-log4j.xml
    - source: salt://qaex/sectran/render/jboss/server/default/conf/jboss-log4j.xml

return -

render20:
    ----------
    file_|-jboss-log4j_|-d:\Apps\jboss\server\default\conf\jboss-log4j.xml_|-managed:
        ----------
        __run_num__:
            0
        changes:
            ----------
        comment:
            An exception occurred in this state: Traceback (most recent call last):
              File "salt/state.py", line 1305, in call
              File "salt/states/file.py", line 1116, in managed
              File "salt/modules/file.py", line 1797, in check_managed
              File "salt/modules/file.py", line 1620, in get_managed
            NameError: global name '__salt__' is not defined

        name:
            d:\Apps\jboss\server\default\conf\jboss-log4j.xml
        result:
            False

joshFive avatar Feb 11 '14 20:02 joshFive

This looks like it's only when using test=True

joshFive avatar Feb 11 '14 22:02 joshFive

@kuyote I just confirmed your finding. This stacktraces with test=True.

Working on it right now.

UtahDave avatar Feb 13 '14 08:02 UtahDave

@kuyote can you test the new 0.17.5 Salt Windows installers? http://docs.saltstack.com/topics/installation/windows.html

Thanks!

UtahDave avatar Feb 14 '14 08:02 UtahDave

@UtahDave,

Since I upgraded to 0.17.5, I got this error on file.recurse:

----------
    State: - file
    Name:      C:\gnuwin32
    Function:  recurse
        Result:    False
        Comment:   An exception occurred in this state: Traceback (most recent call last):
  File "salt/state.py", line 1316, in call
    running = self.call_chunk(low, running, chunks)
  File "salt/states/file.py", line 1660, in recurse
    if not _check_include_exclude(os.path.relpath(mdir, srcpath),
  File "salt/states/file.py", line 1583, in manage_file
    return
  File "salt/states/file.py", line 1157, in managed
    dir_mode)
  File "salt/modules/file.py", line 2060, in manage_file
    if not sfn:
  File "salt/modules/file.py", line 1690, in check_perms
    # user/group changes if needed, then check if it worked
NameError: global name '__salt__' is not defined

If the folder doesn't exist, it works fine, but on the second highstate run, it fails with with above error.

otrempe avatar Feb 14 '14 15:02 otrempe

@UtahDave,

Forget my last comment. It all woks fine since I also upgraded my master to 0.17.5. Sorry for that...

otrempe avatar Feb 14 '14 15:02 otrempe

Great! Thanks.

UtahDave avatar Feb 14 '14 16:02 UtahDave