Open myii opened 4 years ago
Note, this may not be that simple due to uses of import as
.
kubernetes-formula/kubernetes/kubectl/config/environ/install.sls:
{%- from tplroot ~ "/map.jinja" import kubernetes as k8s with context %}
prometheus-formula/prometheus/archive/install.sls:
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
A similar issue is unused Jinja variables.
lighttpd-formula/lighttpd/config.sls@4fca60f
{% set file = lighttpd.get('config', ['lighttpd.conf']) %}
file
is no longer being used anywhere after being set. It used to be, in an earlier version of the file:
lighttpd-formula/lighttpd/config.sls@e69c9a0
- source: {{ files_switch('lighttpd', ['/etc/lighttpd/' ~ file,
'/etc/lighttpd/' ~ file ~ '.jinja']) }}
It would be great if salt-lint
could catch these as well.
Thanks @myii for the feature request!
This requires salt-lint
on (partially) rendering the state, or some logic that can tokenize the Jinja part. The last might actually be easier, but requires writing a tokenizer. Because this only related to the Jinja part, I'm first going to try to fix #19 and #48.
... I'm first going to try to fix #19 and #48.
@roaldnefs Great, thanks for all of your hard work.
Taking this example:
files_switch
isn't actually used anywhere in the file, so should be removed.I've actually come across many of these examples throughout SaltStack Formulas. Would be great if
salt-lint
could catch these.