Search code examples
salt-project

No matching sls found for 'php-apps' in env 'base'


I have the following saltstack top file.

  'blog.php.*':
    - php-apps
    - php-apps.blog

  'app.php.*':
    - php-apps
    - php-apps.some-app

  '*phpone*':
    - php-apps
    - php-apps.blog
    - php-apps.some-app

When I run high state for the above to environments It works fine. like this

salt 'blog.php.*' state.highstate or salt 'app.php.*' state.highstate

But when I run the same for the third server it fails.

salt '*phpone*' state.highstate

Error:

No matching sls found for 'php_apps' in env 'base'

I went to the minion server and found that the init.sls file in php-apps is not being copied over to minion cache location /var/cache/salt/minion/files/base/php-apps

I am not able to find any logs of state file having any compilation error which could cause this.

I tried the following but It still does not work.

  • Cleared master cache
  • Cleared minion cache
  • Recreated minion from scratch

What am I missing? Please let me know if any other information is required.


Solution

  • First , I will use yaml validator to validate the yaml meta structure. i.e.. install kwalify

    #install kwalify
    sudo apt-get install kwalify
    # Now try to check the top file with yaml meta-validation 
    kwalify -m top.sls 
    # to check many yaml sls file
    find . | grep "sls"  | xargs   kwalify -m 
    

    Don't be surprised when salt doesn't verify the most basic meta structure.

    Because saltstack using YAML, it also suffer from tab vs space indentation issues, if you didn't force your editor to convert all TABS to fix spaces.