-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Since you support {{ pillar.get('var') }} in pillar files, then please make {{ pillar['var'] }} work #4326
Comments
We should consolidate these, but this will not work the way proposed. These changes are going to take some serious thought, I am not sure yet how to implement this. |
I have just tried master-minion setup and what I want to tell you in not-stand-alone scheme even {{pillar.get('var')}} is not working. That's a pity ;( |
The example specified here in the docs would satisfy our requirements: https://salt.readthedocs.org/en/latest/topics/pillar/#including-other-pillars However, it appears that said functionality is not implemented. I've read the code https://github.com/saltstack/salt/blob/v0.16.0/salt/pillar/__init__.py#L294 and it looks like the only include support specified there is:
where 'pillar-file-1' becomes the referenced If you make any of the includes a dict, like below, it fails (beneath):
the error:
|
I'm having the same problem. Spent some time trying to run the example shown in the documentation, getting the exact same error. Ended up here after googling it. |
Confirming that I also get the same explody when including other pillars using the second documented form. Just spent a half an hour on it. The docs say "New in version 0.16.0". Would be nice to either remove this from the docs, or implement it. |
I just recently discovered "reclass", a piece of software that does parametrization in a different way, with decent class inheritance support. You may want to take a look: http://reclass.pantsfullofunix.net/ |
@boltronics Can you create a separate issue? If the include syntax isn't working, we need to look into that. Please include as much info as you can, including your pillar files and version info. |
@basepi please see my comment where I point out where I'd expect to see the "second documented form" implemented, but there is clearly no support for additional options other than vanilla pillar include, which does happen to work. The action should be: A) Find where the code went that was supposed to implement the advertised functionality. Write some tests for it. |
Yes, if the syntax in the docs doesn't work, that's definitely a problem. Thanks for all the info, everyone. |
I'm thinking this issue may have been fixed since this issue was last referenced -- I think we had a bug that made pillar not always compile in order, but I'm pretty sure that's resolved. Can anyone still reproduce this issue? |
Since we've had no reply to the request from @basepi and we're fairly certain we have this issue resolved, I'm going to go ahead and closed this. If this proves not to be fully resolved, please leave a comment on this issue and we'll happily re-examine it. Thanks! |
Looks like the example code from the docs is working. Just wanted to get confirmation on one of the other points from this issue @ryba-xek mentioned aboved that {{ pillar.get('var') }} doesn't work in master-minion. Can you confirm that's the case/is expected? That's what I'm seeing also - can raise a bug with recreation if should work |
It works correctly between a master and a minion for me on 2014.7:
|
I may be trying to do something that's invalid/is not expected to work but - I am using pillar.get within the pillar as @ryba-xek did in the first post on this issue. Here's what I've got - expected output would be that variable_two would be 100 also:
|
I've reproduced and resynthesized @cachedout and @colinp85's last comments (the previous two comments) thus: configuration:
execution:
The conclusion is that while |
Oh, right, I completely misread @cachedout's example. It definitely doesn't test the same problem. Now, the question is whether we guarantee the availability of previous pillar values during pillar compilation. I don't think we've written that feature in. |
Has there been any work on this somewhere? I swear this was working for me yesterday on the 2015.2 branch, but today it's not working. EDIT: Trying to find a commit where it does work, I can't, so I guess I must've been imagining things all this time :( |
Same for me - this had been working, but no longer is (as of about your time frame as well). My guess is that we were just getting lucky in terms of pillar load ordering or something similar. |
I would find it very useful to be able to reference other pillar data from within a pillar. In my specific use case I need a higher level of abstraction to target configuration options from pillar data than matching on minion id (or grouping minions), where I would define a bunch of configuration groups (i.e. location) within a configuration type (i.e. specific type of service). An object defining the configuration would also include a list of minions to which the configuration should be targeted. This can be done via a map in a state, as the targeting and configuration targeting descriptions are less confidential than the keys and access credentials to be distributed. But I find it more elegant to leave the specific configuration and targeting of these in pillar, rather than states, to support modularity, low coupling and ability to apply different configurations across different environments via the same state files (think formulas). |
Btw, another way to do this (or workaround, however you look at it), is to load the data structure in question as a dictionary with i.e. load_yaml in the same pillar file. This also supports targeting and selecting the data structure in question with jinja conditionals. If course you don't get the benefits of using the delimiter functionality in salt['pillar.get']. |
ZD-911 |
Generally the ability for a pillar to fetch other pillar data is becoming more important nowadays. Think a pillar that fetches data from a database but needs login credentials. We can work around a lot of problems by using import_yaml but a simple pillar.get() in a py rendered pillar or a salt'pillar.get' as the jinja equivalent is the cleaner solution. I have a few use-cases where having the pillar dunder dictionary around would make my life much easier. Especially coming from the ansible world where it is very common to have group_vars that reference other group_vars. The problem with these self-referential variables is the dependency ordering to make sure that the accessed pillars have been rendered already when they are requested. @thatch45: Maybe that's a quick way to get started on pillar-in-pillar support? Would this be an acceptable approach? |
Any update on this? It would be really useful to be able to reference some pillar in other pillar, almost mandatory in some setup. (without doing hacky stuff) |
Pillarstack is the best approach I've seen so far.
…On Wed, Mar 7, 2018 at 2:07 PM, Maxime Carbonneau ***@***.***> wrote:
Any update on this? It would be really useful to be able to reference some
pillar in other pillar, almost mandatory in some setup. (without doing
hacky stuff)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4326 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACX2Lm_YvVkM-lQMaVsEkodbntPcFLa3ks5tcFo5gaJpZM4AilyM>
.
|
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. |
Still relevant. |
Thank you for updating this issue. It is no longer marked as stale. |
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. |
seems to still be relevant |
Thank you for updating this issue. It is no longer marked as stale. |
I think this would be an interesting feature as well - I stumbled across this issue upon trying to use |
@ryba-xek Closing this due to age, the old version of Salt and Python 2. |
Bsed on this discussion: https://groups.google.com/forum/#!topic/salt-users/gH7DHC0Ck88
{{ pillar['var'] }} is not working when it is used in a pillar .sls file referencing other pillar .sls file.
Here is a demo I just made:
[INFO ] Loaded configuration file: /etc/salt/minion
foo:
bar
foo2:
bar
master:
----------
acceptance_wait_time:
10
arg:
autoload_dynamic_modules:
True
backup_mode:
The text was updated successfully, but these errors were encountered: