Neven.Leung
Neven.Leung

Reputation: 860

salt can't recognize the file_roots in the config of master

I want to execute the following commands:

1) salt '*' state.sls test
(test is the name of the .sls file and its abspath is /srv/salt/test.sls)

the result is:

minion-10-211-55-3:
  Data failed to compile:
----------
  No matching sls found for 'test' in env 'base'

2)salt '*' cp.get_file salt://hello.txt c:/new/hello.txt makedirs=True

(the hello.txt exists in /srv/salt)

This command does not return any result, it is certainly failed.


I used to executed the two commands successfully, but somehow i can't do this someday. I don't remember which config i changed.

the file_roots part in master config is this:

file_roots:
  base:
    - /srv/salt
  dev:
    - /srv/salt-dev

I have been stuck in this problem for a few days.Because these two command are related to the env 'base', i think it is the problem of file_roots config. I have already checked my master config is right, and i have restarted the salt-master by service salt-master restart many times to make the config work.

Why salt still has the problem? The file_roots settings seems to be right. Does the config not work??

Any help, direction is appreciated. Thanks.


The test.sls is:

run-an-exe:
  cmd.run:
    - name: c:/Salt-Minion-2015.8.8-2-AMD64-Setup.exe

I just want to test if salt can control a windows minion to run a .exe from a linux master. When the command is executed successfully, i can check a process named Salt-Minion-2015.8.8-2-AMD64-Setup.exe in the taskmanager.

OS:

master: CentOS 6.7(Final)

minion-10-211-55-3: windows 7

Upvotes: 0

Views: 1412

Answers (1)

mootmoot
mootmoot

Reputation: 13176

  1. Use the simpler modules call salt '*' state.apply test

  2. Make sure master and minion are the same version

  3. When starting salt-master, use sudo salt-master -l debug to run the daemon to diagnose the problem.

  4. ALWAYS VERIFY YOUR STATE file with yaml schema meta parser such as kwalify , e.g. kwalify -m test.sls . Yes, SLS contain syntax error(e.g. mix of tab and spaces) will spit the wrong "missing file" error.

  5. For statement that fail on minion that run previously, restart the minion.

Upvotes: 0

Related Questions