Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] All function from jinja module do not support saltenv #59300

Open
TeddyAndrieux opened this issue Jan 15, 2021 · 1 comment
Open

[BUG] All function from jinja module do not support saltenv #59300

TeddyAndrieux opened this issue Jan 15, 2021 · 1 comment
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@TeddyAndrieux
Copy link
Contributor

TeddyAndrieux commented Jan 15, 2021

Description
All the function of the jinja execution module do not support saltenv argument and also do not use the saltenv from the config

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info).

Steps to Reproduce the behavior
(Include debug logs if possible and relevant)

Just try to use any function of the jinja execution module when your file sit in a saltenv different from base

E.g.:
minion config

file_root:
  my-env:
  - /srv/my-env
saltenv: my-env

A simple yaml file

# /srv/my-env/my-formula/foo.yaml
abc: def

Trying to get this yaml using jinja.import_yaml is impossible since it does not sit in base saltenv

Expected behavior
Honor saltenv from minion config and ideally add a saltenv argument to the function

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3002.2
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.1
       libgit2: Not Installed
      M2Crypto: 0.35.2
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 17.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.1.4
 
System Versions:
          dist: centos 7 Core
        locale: UTF-8
       machine: x86_64
       release: 3.10.0-1127.el7.x86_64
        system: Linux
       version: CentOS Linux 7 Core

Additional context
IMHO jinja function should have the same behavior as slsutil.renderer function (and maybe this module should directly use the slsutil.renderer function)

@TeddyAndrieux TeddyAndrieux added the Bug broken, incorrect, or confusing behavior label Jan 15, 2021
TeddyAndrieux added a commit to scality/metalk8s that referenced this issue Jan 18, 2021
In salt we have a function `jinja.load_map` that retrieve a specific
value from a map.jinja (same as what we do in salt SLS) but this
function does not support saltenv
Add a new function to retrieve information from `map.jinja` in MetalK8s
context, so hardcoded map.jinja path and retrieving saltenv from version
stored in the pillar
Sees: saltstack/salt#59300
TeddyAndrieux added a commit to scality/metalk8s that referenced this issue Jan 18, 2021
In salt we have a function `jinja.load_map` that retrieve a specific
value from a map.jinja (same as what we do in salt SLS) but this
function does not support saltenv
Add a new function to retrieve information from `map.jinja` in MetalK8s
context, so hardcoded map.jinja path and retrieving saltenv from version
stored in the pillar
Sees: saltstack/salt#59300
TeddyAndrieux added a commit to scality/metalk8s that referenced this issue Jan 19, 2021
In salt we have a function `jinja.load_map` that retrieve a specific
value from a map.jinja (same as what we do in salt SLS) but this
function does not support saltenv
Add a new function to retrieve information from `map.jinja` in MetalK8s
context, so hardcoded map.jinja path and retrieving saltenv from version
stored in the pillar
Sees: saltstack/salt#59300
gdemonet pushed a commit to scality/metalk8s that referenced this issue Feb 26, 2021
In salt we have a function `jinja.load_map` that retrieve a specific
value from a map.jinja (same as what we do in salt SLS) but this
function does not support saltenv
Add a new function to retrieve information from `map.jinja` in MetalK8s
context, so hardcoded map.jinja path and retrieving saltenv from version
stored in the pillar
Sees: saltstack/salt#59300

Cherry-picked from: 21a1cfa
@sagetherage sagetherage added severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around and removed needs-triage labels Apr 13, 2021
@sagetherage sagetherage added this to the Approved milestone Apr 13, 2021
@sagetherage
Copy link
Contributor

@TeddyAndrieux we will review a PR for this as it is likely it simply hasn't been thought to do this, yet for saltenv

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug broken, incorrect, or confusing behavior 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