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

Improve pillar include documentation #35521

Closed
oliver-dungey opened this issue Aug 17, 2016 · 8 comments
Closed

Improve pillar include documentation #35521

oliver-dungey opened this issue Aug 17, 2016 · 8 comments
Labels
Core relates to code central or existential to Salt Documentation Relates to Salt documentation Feature new functionality including changes to functionality and code refactors, etc. Pillar stale
Milestone

Comments

@oliver-dungey
Copy link

In formula init files you can use relative path include syntax i.e. put a dot a the beginning of the line and it knows it is relative. The documentation on pillar suggests that the same should be possible but it appears to be failing:

/srv/pillar/top.sls:

base:
  '*':
    - buzz

/srv/pillar/buzz/init.sls

include:
  - .stuff

/srv/pillar/buzz/stuff.sls

zzzz:
  stuff:
    - 1
    - 2
    - 3

Then run salt-call pillar.items and there is an error at the top and the pillar data is missing:

aminion:
    ----------
    _errors:
        - Specified SLS '.stuff' in environment 'base' is not available on the salt master

If I then specify an absolute path it works i.e. change the init.sls file to:

include:
  - buzz.stuff

Versions Report

Salt Version:
           Salt: 2016.3.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.3
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: centos 6.7 Final
        machine: x86_64
        release: 2.6.32-573.el6.x86_64
         system: Linux
        version: CentOS 6.7 Final
@DaveOHenry
Copy link

Ran into a similar issue today in 2016.3.2.
I tried to import a variable collection from a file "vars.jinja" in the file_roots directory /srv/salt. While this works in normal state files with the following code:

{% from "vars.jinja" import vars with context %}

... in pillar files an absolute path is needed:

{% from "/srv/salt/vars.jinja" import vars with context %}

Maybe this is related.

@Ch3LL
Copy link
Contributor

Ch3LL commented Aug 18, 2016

@oliver-dungey looks like this is a duplicate of #8875

although as you state the documentation states it does work. Can you point me to which documentation you are referring to? If that is the case we will need to change issue 8875 from a feature to a bug to get that fixed. Once I have that information from you we will go ahead and close this issue adn track this issue on 8875. Thanks!

@DaveOHenry I think you are right in that the fix for the includes to work with relative paths might be related to your situation but just to make sure they are not two seperate fixes will you please open an issue with what you are seeing and we can just link your issue to 8875 but keep it open in case they are seperate fixes.

@Ch3LL Ch3LL added Duplicate Duplicate of another issue or PR - will be closed info-needed waiting for more info labels Aug 18, 2016
@Ch3LL Ch3LL added this to the Blocked milestone Aug 18, 2016
@oliver-dungey
Copy link
Author

@Ch3LL Sorry, should have taken note of that - I've had a search around but can't find the page I was thinking of. What I have noted on searching around again is that the Pillar Walkthrough page doesn't mention include or talk about init files (https://docs.saltstack.com/en/latest/topics/tutorials/pillar.html) and Storing Static Data in The Pillar (https://docs.saltstack.com/en/latest/topics/pillar/) only has very simple include examples and no mention of init files.

@Ch3LL
Copy link
Contributor

Ch3LL commented Aug 18, 2016

@oliver-dungey okay cool I will keep the feature tag on that same issue because it seems we do not document that it is possible for pillar. I will change the title of this issue report and we will keep this open to track the documentation improvements to add mention of init files with pillar includes. Thanks

@Ch3LL Ch3LL changed the title Pillar relative path includes not working Improve pillar include documentation Aug 18, 2016
@Ch3LL
Copy link
Contributor

Ch3LL commented Aug 18, 2016

Also to note I think it would be smart to temporarily add to the documentation taht currently relative paths are not supported for pillar in the docs until that feature has been completed.

@Ch3LL Ch3LL added Feature new functionality including changes to functionality and code refactors, etc. Documentation Relates to Salt documentation Core relates to code central or existential to Salt Pillar and removed Duplicate Duplicate of another issue or PR - will be closed info-needed waiting for more info labels Aug 18, 2016
@Ch3LL Ch3LL modified the milestones: Approved, Blocked Aug 18, 2016
@damon-atkins
Copy link
Contributor

+1 I just assumed they would behavior the same way.
The . is ignored, it tries to load it from ...../pillar/stuff.sls or ......./pillar/stuff/init.sls

include:
  - .stuff

@damon-atkins
Copy link
Contributor

The work around for the missing enhancement is

include:
  - buzz.stuff

@stale
Copy link

stale bot commented Jul 6, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jul 6, 2018
@stale stale bot closed this as completed Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core relates to code central or existential to Salt Documentation Relates to Salt documentation Feature new functionality including changes to functionality and code refactors, etc. Pillar stale
Projects
None yet
Development

No branches or pull requests

4 participants