salt: requiring sls file containing only includes fail

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)

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 5
  • Comments: 31 (19 by maintainers)

Commits related to this issue

Most upvoted comments

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

I think it is still an issue

@kintel Closing this due to age, the old version of Salt and Python 2. Can you retest this with the latest release of Salt 3006.2 and if still an issue, please open a new issue, which will have metrics in tracking issues.

Just hit the nail with this bug now. I guess that’s the price to pay for trying to write organized formulas. 😦

I also recently ran into this, and it took quite awhile to find this issue and the underlying reason it’s failing. Has there been any movement on this? Or at the very least, could the documentation be updated to point out that requiring an empty sls, or an sls that only has include statements, currently fails?

shame this hasn’t been fixed even after 3 y (spent ages to find why i got this issue)

It appears for understandable reasons there is same behavior when you include an ‘empty’ file, say for example you include a file wrapped in conditionals that don’t trigger. So more appropriately this bug triggers when you simply include an sls without any states.

@OrangeDog Understand what you say about Python, but bit of difference between 2 and 3. Secondly getting originator’s to test with latest, since the Core Team doesn’t have the bandwidth to go through all of these old issues originated in 2014/2015 in our backlog. Yeah, it has been updated this decade, but a number of them have not. With the new GitHub Actions based PR testing etc., able to get through a lot more, than in the past, hence the desire to clean up backlog, and only work on those still relevant.

Hence close, have the originator retest and fill out new issue (with the template filled out) on current code. @baby-gnu Thanks for checking and am assigning myself to the new issue.

will have metrics in tracking issues

What does this mean? Pretending that you haven’t been saying you’ll fix it for nearly a decade?

The situation is exactly the same. The version of Python is irrelevant. It was most recently scheduled for 3003 and then cancelled, so you know it’s still there.

Closing this due to age, the old version of Salt and Python 2. Can you retest this with the latest release of Salt 3006.2 and if still an issue, please open a new issue, which will have metrics in tracking issues.

I still have this issue on 3006.2, I opened #65080 as you requested.

The Core team won’t be able to get to this in Aluminium, moving it back into planning for another release.

Thank you for updating this issue. It is no longer marked as stale.

@eliasp Join the club. 😃 It’s generally not obvious what the problem is when you hit it. This drove me nuts last year until it was burned into my mind to always watch out for this.

I’m very glad to see this bumped up from Low to High severity at least.

Just wasted ~3h on this bug too until I realized what I was dealing with 😃 Using now a simple test.configurable_test_state as workaround which could also be replaced with test.nop (available since 2015.5.6) - depending on the used Salt version.