Salt State Exception: OSError 2

1 August 2015

I was scratching my head on this one. A salt minion reported this in it's log file and some states were not applied to my Windows Virtual Machine.

2015-07-15 22:47:52,427 [salt.state       ][ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "salt/", line 1379, in call
  File "c:\salt\var\cache\salt\minion\extmods\states\", line 96, in extracted
    file_result = __salt__['state.high'](data)
  File "salt/modules/", line 172, in high
  File "salt/", line 535, in __init__
  File "salt/", line 552, in _gather_pillar
  File "salt/pillar/", line 44, in get_pillar
  File "salt/pillar/", line 58, in __init__
  File "salt/transport/", line 24, in factory
  File "salt/transport/", line 50, in __init__
  File "salt/", line 519, in __init__
  File "salt/", line 531, in __authenticate
  File "salt/", line 363, in sign_in
  File "salt/", line 242, in minion_sign_in_payload
  File "salt/utils/", line 1166, in mkstemp
  File "", line 304, in mkstemp
  File "", line 239, in _mkstemp_inner
OSError: [Errno 2] No such file or directory: 'c:\\users\\buildu~1\\appdata\\local\\temp\\1\\tmpyllbfy'

It then dawned on me. I recently wrote a salt state to clean the NUnit shadowcache.

    - name: 'C:/users/buildUser/appData/local/temp'

It looks as though it was removing all salt temp files causing the above error. I changed the path to delete the nunit20 folder in the temp folder.s

    - name: 'C:/users/buildUser/appData/local/temp/nunit20'

Happy days!