saltstack / saltstack/salt

[BUG] Salt Exception with message "Event iteration failed with exception: 'list' object has no attribute 'items'"

Open
#64,556 9 comments 0 reactions 1 assignee View on GitHub

@dwoz is already working on this.

Since Feb 19, 2024.

bug
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
We did not change any configuration, so the setup was running before. We want to deploy a Mailserver using Terraform which is calling the salt stack.

When running a High State, we get the following errors:

Minion Log:

module.product_mailservers[3].module.nutanixvm.null_resource.salt-bootstrap (remote-exec): [DEBUG   ] LazyLoaded highstate.output
module.product_mailservers[3].module.nutanixvm.null_resource.salt-bootstrap (remote-exec): local:
module.product_mailservers[3].module.nutanixvm.null_resource.salt-bootstrap (remote-exec):     Data failed to compile:
module.product_mailservers[3].module.nutanixvm.null_resource.salt-bootstrap (remote-exec): ----------
module.product_mailservers[3].module.nutanixvm.null_resource.salt-bootstrap (remote-exec):     Pillar failed to render with the following messages:
module.product_mailservers[3].module.nutanixvm.null_resource.salt-bootstrap (remote-exec): ----------
module.product_mailservers[3].module.nutanixvm.null_resource.salt-bootstrap (remote-exec):     Rendering SLS 'mailserver.opendkim' failed. Please see master log for details.
module.product_mailservers[3].module.nutanixvm.null_resource.salt-bootstrap (remote-exec): ----------
module.product_mailservers[3].module.nutanixvm.null_resource.salt-bootstrap (remote-exec):     Rendering SLS 'mailserver.opendkim' failed. Please see master log for details.

Master Log:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/pillar/__init__.py", line 896, in render_pstate
    **defaults
  File "/usr/lib/python3/dist-packages/salt/template.py", line 99, in compile_template
    ret = render(input_data, saltenv, sls, **render_kwargs)
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in __call__
    return self.loader.run(run_func, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/renderers/jinja.py", line 75, in render
    **kws
  File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 261, in render_tmpl
    output = render_str(tmplstr, context, tmplpath)
  File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 509, in render_jinja_tmpl
    raise SaltRenderError("Jinja variable {}{}".format(exc, out), buf=tmplstr)
salt.exceptions.SaltRenderError: Jinja variable 'dict object' has no attribute 'addresses'
2023-06-27 15:16:45,724 [salt.pillar      :1224][CRITICAL][134604] Pillar render error: Rendering SLS 'mailserver.opendkim' failed. Please see master log for details.
2023-06-27 15:16:45,724 [salt.pillar      :1224][CRITICAL][134604] Pillar render error: Rendering SLS 'mailserver.opendkim' failed. Please see master log for details.
2023-06-27 15:16:45,883 [salt.utils.event :908 ][ERROR   ][134459] Event iteration failed with exception: 'list' object has no attribute 'items'
2023-06-27 15:16:55,288 [salt.utils.event :908 ][ERROR   ][134475] Event iteration failed with exception: 'list' object has no attribute 'items'
2023-06-27 15:18:18,594 [salt.utils.event :908 ][ERROR   ][134515] Event iteration failed with exception: 'list' object has no attribute 'items'
2023-06-27 15:23:25,128 [salt.utils.event :908 ][ERROR   ][134491] Event iteration failed with exception: 'list' object has no attribute 'items'
2023-06-27 15:24:07,291 [salt.utils.event :908 ][ERROR   ][134514] Event iteration failed with exception: 'list' object has no attribute 'items'
2023-06-27 15:27:16,587 [salt.utils.event :908 ][ERROR   ][134521] Event iteration failed with exception: 'list' object has no attribute 'items'

Setup

  • [ X] on-prem machine
  • [ X] VM - Nutanix
  • [ X] in combination with Terraform - TF calls the salt stack do deploy an application

The following file is called when the problem occurs:

opendkim.sls:

{%- if pillar.get('opendkim-key') %}
include:
  - base: opendkim

opendkim-schedule:
  schedule.present:
    - function: state.sls
    - job_args:
      - mailserver.opendkim
    - seconds: 21600
    - splay:
        start: 300
        end: 1500
    - run_on_start: false
    - maxrunning: 1
    - jid_include: True
{%- else %}
opendkim-schedule:
  schedule.absent:
    - name: opendkim-schedule
{%- endif %}

Steps to Reproduce the behavior
Run the state either manually or use Terraform.

Expected behavior
Salt Stack should be called, running and deploy the Mailserver as configured.

Screenshots
I don't think they're needed here.

Versions Report

root@salt01: /var/log/salt # salt --versions-report Salt Version: Salt: 3004.2

Dependency Versions:
cffi: 1.15.1
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: 2.0.5
gitpython: 2.1.11
Jinja2: 2.10
libgit2: 1.5.0
M2Crypto: Not Installed
Mako: 1.1.3
msgpack: 0.5.6
msgpack-pure: Not Installed
mysql-python: 1.3.10
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.6.1
pygit2: 1.10.0
Python: 3.7.3 (default, Jan 22 2021, 20:04:44)
python-gnupg: Not Installed
PyYAML: 3.13
PyZMQ: 17.1.2
smmap: 2.0.5
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.1

System Versions:
dist: debian 10 buster
locale: UTF-8
machine: x86_64
release: 4.19.0-21-amd64
system: Linux
version: Debian GNU/Linux 10 buster

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.