state.highstate file not found error, where state.sls works

1,334 views
Skip to first unread message

Robert

unread,
Dec 17, 2013, 12:29:03 PM12/17/13
to salt-...@googlegroups.com
Hi,
 
I'm doing a very basic testing on version 0.17.2, and I can't seem to get highstate to work. When pushing a file out to the minion I get 'file not found' when clearly the file is there, and state.sls has no problems finding it. The same happens with both a zmq/windows minion and over salt-ssh to a rhel host. The zmq minion is also on 17.2.
 
Is this a bug, or am I missing something obvious? See below and thanks in advance.
 
 

[root@salt]# salt 'minion-win' state.highstate -t 60
minion-win:
----------
    State: - file
    Name:      c:\file.txt
    Function:  managed
        Result:    False
        Comment:   Source file salt://test/file.txt not found
        Changes:

Summary
------------
Succeeded: 0
Failed:    1
------------
Total:     1
 


[root@salt]# salt 'minion-win' state.sls test.pushfile -t 60
minion-win:
----------
    State: - file
    Name:      c:\file.txt
    Function:  managed
        Result:    True
        Comment:   File c:\file.txt updated
        Changes:   diff: New file
 
 

Summary
------------
Succeeded: 1
Failed:    0
------------
Total:     1
 
[root@salt]# pwd
/srv/salt
 
[root@salt]# tree
.
|-- test
|   |-- file.txt
|   |-- pushfile.sls
|-- top.sls
`-- win
    `-- repo
        `-- winrepo.p
 

[root@salt]# cat top.sls
test:
  '*':
    - pushfile

 

 

[root@salt]# cat test/pushfile.sls
c:/file.txt:
  file:
    - managed
    - source: salt://test/file.txt
 

 
[root@salt]# salt --versions-report
           Salt: 0.17.2
         Python: 2.6.8 (unknown, Nov  7 2012, 14:47:34)
         Jinja2: 2.5.5
       M2Crypto: 0.21.1
msgpack-python: 0.1.12
   msgpack-pure: Not Installed
       pycrypto: 2.3
         PyYAML: 3.08
          PyZMQ: 2.1.9
            ZMQ: 2.2.0

 

[root@salt]# salt-ssh 'minion-rhel' state.highstate
minion-rhel:
    ----------
    file_|-/tmp/file.txt_|-/tmp/file.txt_|-managed:
        ----------
        __run_num__:
            0
        changes:
            ----------
        comment:
            Source file salt://test/file.txt not found
        name:
            /tmp/file.txt
        result:
            False


 
[root@salt]# salt-ssh 'minion-rhel' state.sls test.pushfile
minion-rhel:
    ----------
    file_|-/tmp/file.txt_|-/tmp/file.txt_|-managed:
        ----------
        __run_num__:
            0
        changes:
            ----------
            diff:
                New file
        comment:
            File /tmp/file.txt updated
        name:
            /tmp/file.txt
        result:
            True

 

Colton Myers

unread,
Dec 18, 2013, 1:32:32 PM12/18/13
to salt-...@googlegroups.com
Can you please show us your master config?  Specifically the fileserver_backend settings and file_roots settings.

--
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/groups/opt_out.

Robert

unread,
Dec 18, 2013, 1:37:52 PM12/18/13
to salt-...@googlegroups.com
Just to clarify this a bit more, the same state works fine when invoking it directly via state.sls, but when calling it with state.highstate it fails with 'source file not found'. The state simply just copies a file from master to minion. That tells me the problem might be with highstate in 17.2. The results are the same with both salt and salt-ssh.
 
Anyone else experiencing this?
 
Thanks,
Robert.

John R. Baskwill

unread,
Dec 18, 2013, 1:42:01 PM12/18/13
to salt-...@googlegroups.com
I had this problem with 17.0 when using the Salt file server.  I moved my files to a web server, and the problem went away.


--
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/groups/opt_out.



--
John R. Baskwill, jr...@psu.edu
Systems Analyst, Information Technology Services
Penn State Harrisburg
W303 Olmsted Building
777 West Harrisburg Pike
Middletown, PA 17057-4898
Phone: 717-948-6268
Fax: 717-948-6535

Robert

unread,
Dec 18, 2013, 3:32:41 PM12/18/13
to salt-...@googlegroups.com
Hi Colton,
 
the fileserver_backend setting was originally commented out in the master config, I have now enabled it and restarted salt-master but the issue remains. Below is the config.
 
fileserver_backend:
  - roots
 
file_roots:
  base:
    - /srv/salt
  test:
    - /srv/salt/test
 
Thanks,
Robert.

David Anderson

unread,
Dec 18, 2013, 4:28:47 PM12/18/13
to salt-...@googlegroups.com
Hi Robert,

The overlapping file_roots is the problem. You are placing all minions
into the 'test' environment from your top.sls file. When the highstate
data is compiled, it looks for the file_roots path of test, which is
/srv/salt/test - this is appended to the file path of the "source" in
your state function. The path for test.txt is compiled as
/srv/salt/test/test/test.txt when in the 'test' env.

The single state.sls run works because you are not specifying an
environment, so it defaults to 'base'. In this case, the file_roots for
base and the specified "source" in your state function is
/srv/salt/test/test.txt which is correct.

I'd recommend putting the 'base' file_roots at /srv/salt/base and test
at /srv/salt/test and move the top.sls to /srv/salt/base. You can then
call highstate and the single state run would be: salt 'rhel-minion'
state.sls pushfile env=test

Cheers,
--
Dave
> <javascript:>.
> For more options, visit
> https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.

Robert

unread,
Dec 18, 2013, 10:28:15 PM12/18/13
to salt-...@googlegroups.com
Hi Dave,
 
thanks a lot for your help, I think you're onto something. Creating /srv/salt/test/test/file.txt made highstate run successfully. However, moving base into /srv/salt/base along with the top file didn't fix my problem (without the above sub directory).
 
Is there a way to see how the the path gets compiled? This would be helpful in troubleshooting, I have tried debug mode and running state.show_lowstate, state.show_highstate etc, but source paths are only listed as salt://test/file.txt. I'll do some digging on this though...
 
Regarding running the single state.sls, I do specify the environment as part of the sls name: salt 'minion' state.sls test.pushfile
 
Thanks again,
Robert.

Colton Myers

unread,
Dec 20, 2013, 2:55:09 PM12/20/13
to salt-...@googlegroups.com
`test.pushfile` does not mean "pushfile.sls in env test".  Rather, it actually means "pushfile.sls in *directory* test".  You need to pass in `env=test` if I remember correctly.  (That's changing to `saltenv=test` in the next release).

--
Colton Myers
Reply all
Reply to author
Forward
0 new messages