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

documentation state.file.managed parameter template not reflecting TEMPLATE_REGISTRY #35336

Closed
Sylvain303 opened this issue Aug 10, 2016 · 8 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior Core relates to code central or existential to Salt Documentation Relates to Salt documentation fixed-pls-verify fix is linked, bug author to confirm fix P4 Priority 4 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@Sylvain303
Copy link

Description of Issue/Question

Issue about the documentation:
https://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html#salt.states.file.managed

it is said:

template
If this setting is applied then the named templating engine will be used to render the downloaded file, currently jinja, mako, and wempy are supported

The templating engine limitation is false, and not only limited to what is written:

        # Apply templating
        contents = salt.utils.templates.TEMPLATE_REGISTRY[template](
            contents,
            from_str=True,
            to_str=True,
            context=context_dict,
            saltenv=saltenv,
            grains=__grains__,
            pillar=__pillar__,
            salt=__salt__,
opts=__opts__)['data'].encode('utf-8')
TEMPLATE_REGISTRY = {
    'jinja': JINJA,
    'mako': MAKO,
    'py': py,
    'wempy': WEMPY,
    'genshi': GENSHI,
    'cheetah': CHEETAH,
}

It is confusing and should be changed.
May be the template engines available can be listed in some way.

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

salt-call --versions-report
Salt Version:
           Salt: 2016.3.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          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.2
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.4.0
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.5 
        machine: x86_64
        release: 3.16.0-4-amd64
         system: Linux
        version: debian 8.5 

example of template: py

works fine, but hard to guess…

state.sls

/tmp/pipo:
  file.managed:
    - template: py
    - source: salt://pipo.py
    - defaults:
        molo: some one fall into the watter

pipo.py

#!py
def run():
    molo = globals()['context']['molo']
    return molo + ','.join(globals().keys())
@Ch3LL
Copy link
Contributor

Ch3LL commented Aug 10, 2016

@Sylvain303 thanks for pointing this out. Looks like we need to add more renderers to that list in the documentation.

@Ch3LL Ch3LL added Documentation Relates to Salt documentation Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Core relates to code central or existential to Salt P4 Priority 4 labels Aug 10, 2016
@Ch3LL Ch3LL added this to the Approved milestone Aug 10, 2016
@rallytime
Copy link
Contributor

Thanks @Sylvain303 - I have fixed this with #35360.

@rallytime rallytime added fixed-pls-verify fix is linked, bug author to confirm fix TEAM Core labels Aug 10, 2016
@rallytime rallytime modified the milestones: C 5, Approved Aug 10, 2016
@rallytime rallytime self-assigned this Aug 10, 2016
@Sylvain303
Copy link
Author

Your change seems OK.
cool. :)
When will it be pushed on line?

Could it be links to related renders, also?

Is there an information command that could list available template engine in our current salt installation already?

@rallytime
Copy link
Contributor

rallytime commented Aug 11, 2016

When will it be pushed on line?

Hm. It should already be live on 2016.3. I think something must be up with our doc building. I'll look into that.

Could it be links to related renders, also?

Definitely! Good idea. I'll make a follow-up PR and link it here.

Is there an information command that could list available template engine in our current salt installation already?

Not that I know of. Want to file another issue as a feature request for that type of functionality?

@rallytime
Copy link
Contributor

I wasn't able to figure out how to fix the doc builds presently. I have filed a new issue about that in #35399.

The link additions to each renderer have been added to the docs in #35406.

rallytime pushed a commit that referenced this issue Aug 12, 2016
* Provide links to the renderers in the template docs

Follow-up for #35360, also references #35336

* Whitespace fix
@Sylvain303
Copy link
Author

in #35408 I looked at the output of salt '*' sys.doc a lot of references to template are listed here.

May be the doc is false at many places in fact…

Still no doc update online, when it is supposed to occur?
Is it bugged as you suggest in #35399, or is it related to version release process?

@rallytime
Copy link
Contributor

@Sylvain303 It is a bug in our doc building process. I have asked @jacobhammons to look into it on the issue that I made.

Also, I meant to look for other template references in this file, but I clearly forgot to follow up on that. Thanks for the reminder.

@rallytime
Copy link
Contributor

@Sylvain303 I have amended the other template doc references to include the list of available templates in #35498. Thanks for following up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Core relates to code central or existential to Salt Documentation Relates to Salt documentation fixed-pls-verify fix is linked, bug author to confirm fix P4 Priority 4 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

3 participants