Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pillar relative includes #52156

Merged
merged 2 commits into from
Mar 12, 2019

Conversation

waynew
Copy link
Contributor

@waynew waynew commented Mar 12, 2019

What does this PR do?

Implements longstanding request #8875 - allows for pillar relative includes

What issues does this PR fix or reference?

#8875 - there are probably others

Previous Behavior

A leading dot in a pillar include was a nop. If you had a pillar like:

foo/bar/baz.sls

include:
  - .bang

That would not refer to foo/bar/bang.sls, but bang.sls at the pillar root.

New Behavior

Now leading dots in includes refer to relative imports 🎉

Tests written?

Yes

Commits signed with GPG?

Yes


I'm operating under the assumption that #52008 will be merged.. forward?

Fixes saltstack#8875 - a longstanding issue
@waynew waynew requested a review from a team as a code owner March 12, 2019 17:18
@waynew waynew requested a review from dmurphy18 March 12, 2019 17:19
@dwoz dwoz merged commit 96b407a into saltstack:develop Mar 12, 2019
@mchugh19
Copy link
Contributor

Can/should this be added to release notes?

@max-arnold
Copy link
Contributor

max-arnold commented Aug 29, 2019

@waynew It would be nice if this feature worked exactly as in states, i.e. multiple dots should work too: https://docs.saltstack.com/en/latest/ref/states/include.html#relative-include

include:
  - ..http
  - ...base

Also, no docs at all 😞

@waynew waynew deleted the 8875-pillar-relative-includes branch August 30, 2019 16:21
@waynew
Copy link
Contributor Author

waynew commented Aug 30, 2019

@max-arnold Do pillar relative includes work that way?

@max-arnold
Copy link
Contributor

max-arnold commented Aug 31, 2019

@waynew

Do pillar relative includes work that way?

No, pillar includes do not work that way, but it makes sense to implement because state includes support this, and feature symmetry is generally a good thing. See the states doc I mentioned earlier: https://docs.saltstack.com/en/latest/ref/states/include.html#relative-include

In Salt 2015.8, the ability to include SLS formulas which are relative to the parents of the running SLS formula was added. In order to achieve this, precede the formula name with more than one . (dot). Much like Python's relative import abilities, two or more leading dots represent a relative include of the parent or parents of the current package, with each . representing one level after the first.

@waynew
Copy link
Contributor Author

waynew commented Sep 6, 2019

Wow, I'm not sure at all what I meant there 🙃

I think it's probably worth creating an issue/feature request. I don't know if it's significant enough to create a SEP, but I agree with the feature symmetry point.

@waynew
Copy link
Contributor Author

waynew commented Feb 19, 2020

When porting this to master it should be noted that it closes #56186

waynew added a commit to waynew/salt that referenced this pull request Apr 22, 2020
Allow pillar relative includes

Fixes saltstack#8875 and Fixes saltstack#56186
@joechainz joechainz mentioned this pull request Apr 22, 2020
dwoz added a commit that referenced this pull request Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants