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

[BUG] win_pkg.genrepo does not pass saltenv to template.compile_template #61807

Closed
afischer-opentext-com opened this issue Mar 18, 2022 · 1 comment
Assignees
Labels
Bug broken, incorrect, or confusing behavior

Comments

@afischer-opentext-com
Copy link
Contributor

afischer-opentext-com commented Mar 18, 2022

Description

win_pkg.genrepo does not pass saltenv to template.compile_template

While investigating an issue and digging in the code we found the function win_pkg.genrepo() calls win_pkg._repo_process_pkg_sls() which in turn call templates.compile_template().

While win_pkg.genrepo() and templates.compile_template() support an argument saltenv, the function win_pkg._repo_process_pkg_sls() does not, and therefore does not passed the desired saltenv to templates.compile_template()

Request:

This an issue when using the saltenv jinja2 variable within the repo-ng package descriptions and may be an issue when using pillarenvs. Request is to pass the variable properly.

Setup

Any Windows minion affected.

Steps to Reproduce the behavior

Have a package description

banana:
  '1.2.3':
    full_name: 'Banana {{ saltenv }}'
    installer: C:/store/banana_{{ saltenv }}.msi
    msiexec: false
    locale: en_US
    reboot: false

Run

salt MINION pkg.refresh_db saltenv=foo

Find that a package install fails, because there is no file C:/store/banana_base.msi as requested.

Expected behavior

The passed saltenv shall be used when rendering win repo-ng package descriptions

Versions Report

salt --versions-report
Salt Version:
          Salt: 3004

Dependency Versions:
          cffi: 1.14.6
      cherrypy: 18.6.1
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: 4.0.7
     gitpython: Not Installed
        Jinja2: 2.10.1
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: 1.1.4
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: Not Installed
  pycryptodome: 3.10.1
        pygit2: Not Installed
        Python: 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64 bit (AMD64)]
  python-gnupg: 0.4.7
        PyYAML: 5.4.1
         PyZMQ: 19.0.0
         smmap: 4.0.0
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.2

System Versions:
          dist:
        locale: cp1252
       machine: AMD64
       release: 2019Server
        system: Windows
       version: 2019Server 10.0.17763 SP0 Multiprocessor Free

Additional context

_repo_process_pkg_sls(

def _repo_process_pkg_sls(filename, short_path_name, ret, successful_verbose):

config = salt.template.compile_template(

@twangboy
Copy link
Contributor

#66181 should fix this issue

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
Projects
None yet
Development

No branches or pull requests

4 participants