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

create a method for documenting defaults and which pillar keys are available in the repo #131

Open
ketzacoatl opened this issue Jul 19, 2018 · 2 comments

Comments

@ketzacoatl
Copy link
Contributor

Imagine a snippet like this:

 # install python and setuptools, leave pip to python.pip and dev to python.dev
{%- set default_2or3 = '' %}
{%- set _2or3 = salt['pillar.get']('python_2or3', default_2or3) %}

It would be really nice to have a tool that does the following:

  • search for these set lines
  • for all entries with default_ as the prefix, collect those as "defaults"
  • for all entries with pillar.get, collect the keys, and the referenced defaults
  • render a markdown file (or set of files) to document this aspect of the formula
@neilmayhew
Copy link
Member

There's a Haskell library called ginger that could be used to parse the files. It would be possible to get the variable assignments from the parsed syntax tree, and then to find the ones we're interested in.

@neilmayhew
Copy link
Member

PoC implementation in https://gitlab.fpcomplete.com/neil/salt-indexer. See especially README and NEWS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants