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] Mako error on pillars render after upgrade to 3006.1 #64280

Closed
2 of 9 tasks
arkpoah opened this issue May 15, 2023 · 5 comments · Fixed by #64341 · May be fixed by openSUSE/salt#694
Closed
2 of 9 tasks

[BUG] Mako error on pillars render after upgrade to 3006.1 #64280

arkpoah opened this issue May 15, 2023 · 5 comments · Fixed by #64341 · May be fixed by openSUSE/salt#694
Assignees
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Regression The issue is a bug that breaks functionality known to work in previous releases.

Comments

@arkpoah
Copy link

arkpoah commented May 15, 2023

Description
After upgrade Salt master to 3006.1 and migrate to onedir, I get Mako error when trying to run a highstate.

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on Azure (2 cpu 4G memory)
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install
# salt-pip list
Package            Version
------------------ ---------
certifi            2022.12.7
cffi               1.14.6
chardet            3.0.4
cheroot            8.5.2
CherryPy           18.6.1
contextvars        2.4
cryptography       39.0.2
distro             1.5.0
idna               2.8
immutables         0.15
importlib-metadata 6.0.0
jaraco.classes     3.2.1
jaraco.collections 3.4.0
jaraco.functools   2.0
jaraco.text        3.5.1
Jinja2             3.1.2
jmespath           1.0.1
looseversion       1.0.2
Mako               1.2.4
MarkupSafe         2.1.2
more-itertools     5.0.0
msgpack            1.0.2
packaging          22.0
pip                22.3.1
portend            2.4
psutil             5.8.0
pycparser          2.21
pycryptodomex      3.9.8
pygit2             1.11.1
pyOpenSSL          23.0.0
python-consul      1.1.0
python-dateutil    2.8.1
python-gnupg       0.4.8
pytz               2022.1
PyYAML             5.4.1
pyzmq              23.2.0
relenv             0.12.3
requests           2.25.1
rpm-vercmp         0.1.2
salt               3006.1
setproctitle       1.3.2
setuptools         65.7.0
six                1.16.0
tempora            4.1.1
timelib            0.2.5
urllib3            1.26.6
wheel              0.40.0
zc.lockfile        1.4
zipp               3.6.0

Steps to Reproduce the behavior
When running a salt highstate on a minion with same version, I get this error :

~# salt-call --state-output=changes state.highstate test
[INFO    ] Loading fresh modules for state activity
local:
    Data failed to compile:
----------
    Pillar failed to render with the following messages:
----------
    Rendering SLS 'azr.dev-francecentral.sensugo' failed. Please see master log for details.

Pillar file content :

➜ cat azr/dev-francecentral/sensugo.sls 
#!jinja|mako|yaml|gpg

sudoers:
  included_files:
    /etc/sudoers.d/sensu:
      users:
        sensu:
          - 'ALL=(root) NOPASSWD: ALL'

On master logs :

 [CRITICAL] Rendering SLS 'azr.dev-francecentral.consul' failed, render error:
 Traceback (most recent call last):
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/templates.py", line 218, in render_tmpl
     output = render_str(tmplstr, context, tmplpath)
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/templates.py", line 579, in render_mako_tmpl
     lookup.destroy()
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/mako.py", line 102, in destroy
     if self.client:
 AttributeError: 'SaltMakoTemplateLookup' object has no attribute 'client'
 Traceback (most recent call last):
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/__init__.py", line 919, in render_pstate
     state = compile_template(
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/template.py", line 99, in compile_template
     ret = render(input_data, saltenv, sls, **render_kwargs)
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
     return self.loader.run(run_func, *args, **kwargs)
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1232, in run
     return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1247, in _run_as
     return _func_or_method(*args, **kwargs)
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/renderers/mako.py", line 41, in render
     raise SaltRenderError(
 salt.exceptions.SaltRenderError: Traceback (most recent call last):
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/templates.py", line 218, in render_tmpl
     output = render_str(tmplstr, context, tmplpath)
   File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/templates.py", line 579, in render_mako_tmpl

Expected behavior
Running correctly as previous version

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3006.1
 
Python Version:
        Python: 3.10.11 (main, May  5 2023, 02:31:54) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: 1.5.0
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: 1.2.4
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: 1.11.1
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
        relenv: 0.12.3
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: debian 10 buster
        locale: utf-8
       machine: x86_64
       release: 4.19.0-24-cloud-amd64
        system: Linux
       version: Debian GNU/Linux 10 buster
@arkpoah arkpoah added Bug broken, incorrect, or confusing behavior needs-triage labels May 15, 2023
@welcome
Copy link

welcome bot commented May 15, 2023

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@OrangeDog
Copy link
Contributor

@arkpoah
Copy link
Author

arkpoah commented May 15, 2023

Mako is installed like mentionned in my salt-pip list above.
Did I miss something ?

@s0undt3ch
Copy link
Collaborator

This is valid and it was introduced by me for 3006.1

25821ae#diff-656d829a3889f93900422b6eb9e1c22fd1c85df0e64e134c1b17c21da008c6e5R101

@arkpoah
Copy link
Author

arkpoah commented May 16, 2023

ok, but why this error is triggered ?
It concerns all our pillar files which contain #!mako in headers
Ours pillars are loaded from Git

@OrangeDog OrangeDog added Regression The issue is a bug that breaks functionality known to work in previous releases. Confirmed Salt engineer has confirmed bug/feature - often including a MCVE labels May 16, 2023
s0undt3ch added a commit to s0undt3ch/salt that referenced this issue May 24, 2023
s0undt3ch added a commit to s0undt3ch/salt that referenced this issue May 24, 2023
s0undt3ch added a commit to s0undt3ch/salt that referenced this issue May 25, 2023
@Ch3LL Ch3LL closed this as completed in 560ab52 Jun 12, 2023
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 Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Regression The issue is a bug that breaks functionality known to work in previous releases.
Projects
None yet
4 participants