question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

requiring sls file containing only includes fail

See original GitHub issue

I have the following file structure:

includetest/init.sls
includetest/subtestfile.sls
includetest/testfile.sls

init.sls:

include:
  - includetest.testfile

/home/deploy/testfile2.txt:
  file.managed:
    - contents: Hello
    - require:
      - sls: includetest.testfile

testfile.sls:

include:
  - .subtestfile

subtestfile.sls:

/home/deploy/subtestfile.txt:
  file.managed:
    - contents: Hello

When running salt-call state.sls includetest, I get:

    State: - file
    Name:      /home/deploy/testfile2.txt
    Function:  managed
        Result:    False
        Comment:   The following requisites were not found:
                   require:
                       sls: includetest.testfile

Playing around a bit, it appears that this is caused by requiring a file containing only includes. A workaround is to modify testfile.sls to do some arbitrary work.

Is this a bug or by design? My use-case is to have a file including a bunch of states and requiring that file from various places. (Tested on 0.17.5)

Issue Analytics

  • State:open
  • Created 10 years ago
  • Reactions:5
  • Comments:26 (15 by maintainers)

github_iconTop GitHub Comments

7reactions
Reiner030commented, Apr 20, 2017

Belated happy 3rd birthday to this bug 😉 Is there sometimes a fix to be in sight? Since on other usages this multilevel references are unproblematic (pillar, grains, sls references for includes) it shouldn’t be too problematic / difficult to get here also a solution?

The above mentioned workaround could /has to be used then but I was just trying to avoid single state reference and use a whole sls as required_in because saltstack likes to play dice with state ordering already also in the referenced sls

5reactions
kiemliczcommented, Mar 26, 2019

I think it is still an issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Requisites and Other Global State Arguments
The onchanges requisite makes a state only apply if the required states generate changes, and if the watched state's "result" is True (does...
Read more >
Require sls by its ID Declaration - salt stack
The module php/init.sls contains only one ID Declaration : {pkg: php53u}. ID Declaration is composed of state name (pkg) and component name ...
Read more >
SaltStack: Call a single state of a sls file - Server Fault
I came across this post while also trying to figure out how to do this with regular salt calls (ie. not salt-ssh).
Read more >
Using states for configuration management | Mastering SaltStack
Requisites point to a list of items elsewhere in the SLS file that affect the behavior of the state. Each item in the...
Read more >
salt.states.file - Read the Docs
Regular files can be enforced with the managed function. ... clean: Make sure that only files that are set up by salt and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found