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

Unable to have a template with file.managed contents (or contents_pillar) #14664

Closed
jacksontj opened this issue Jul 31, 2014 · 7 comments

Comments

Projects
None yet
4 participants
@jacksontj
Copy link
Contributor

commented Jul 31, 2014

Template doesn't run, so it just writes out the raw jinja template :(

@UtahDave

This comment has been minimized.

Copy link
Member

commented Jul 31, 2014

Did you add the:

template: jinja

to your file.managed?

@jacksontj

This comment has been minimized.

Copy link
Contributor Author

commented Jul 31, 2014

Yea, but if you don't use an http or salt source it doesn't get run through
the template (jinja) before writing to disk.
On Jul 31, 2014 12:35 PM, "David Boucha" notifications@github.com wrote:

Did you add the:

template: jinja

to your file.managed?


Reply to this email directly or view it on GitHub
#14664 (comment).

@jacksontj

This comment has been minimized.

Copy link
Contributor Author

commented Jul 31, 2014

To better explain if i have an SLS that looks like:

/tmp/testfile:
    file.managed:
        - contents_pillar: foo
        - template: jinja

and a pillar test.sls that looks like:

#!py

def run():
    return {'foo': "{{ grains['fqdn'] }}"}

Then i get a file that looks like:

{{ grains['fqdn'] }}

With this setup I would imagine that the contents (the {{grains}} stuff) would be run through the jinja template on the minion before writing to disk.

@whiteinge

This comment has been minimized.

Copy link
Contributor

commented Aug 1, 2014

You don't need it with the contents flag since the same context is
available to the .sls file that would be available to the template.

I can see some utility for running the contents_pillar through,
although most the same context is available between the two again.

OOC what's your actual use-case here?

@jacksontj

This comment has been minimized.

Copy link
Contributor Author

commented Aug 1, 2014

The particular use case is that we have some in-house config system that i've integrated in salt. Originally we had a pillar module which determined the http endpoint for the files, but since its just a git checkout-- we put it on the master to serve the files itself-- in the pillar. Those files have jinja markup-- expecting to run through salt's templater before hitting disk.

I think this would be useful for contents as well, if you weren't using jinja sls files (python ones lets say).

@whiteinge

This comment has been minimized.

Copy link
Contributor

commented Aug 1, 2014

Gotcha. Plus this would be a good addition for consistency's sake.

@whiteinge whiteinge added this to the Approved milestone Aug 1, 2014

@basepi basepi removed the Medium Severity label Aug 5, 2014

@dr4Ke dr4Ke referenced this issue Mar 11, 2016

Merged

Fix template on contents 2015.8 #31815

1 of 2 tasks complete

@stale stale bot added the stale label Aug 22, 2017

@stale

This comment has been minimized.

Copy link

commented Aug 22, 2017

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 closed this Aug 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.