You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Python 2, calling the "values" method of a dictionary returned a list that then could be accessed using an index, but in Python 3 the "values" method returns a iterable object that can't be indexed.
Steps to reproduce the bug
Salt-3004.1 server
Salt-minion linux 7.9
github postfix formulas
Expected behaviour
You will get the same output as I did
ID: postfix_smtp_sasl_password_maps
Function: file.managed
Name: /etc/postfix/sasl_passwd
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 502, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 10, in top-level template code
File "/usr/lib/python3.6/site-packages/jinja2/sandbox.py", line 462, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/jinja2/runtime.py", line 679, in _invoke
rv = self._func(*arguments)
File "<template>", line 2, in template
File "/usr/lib/python3.6/site-packages/jinja2/tests.py", line 158, in test_iterable
iter(value)
jinja2.exceptions.UndefinedError: odict_values object has no element 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/state.py", line 2180, in call
*cdata["args"], **cdata["kwargs"]
File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3.6/site-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.6/site-packages/contextvars/__init__.py", line 38, in run
return callable(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1216, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1249, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/states/file.py", line 3026, in managed
**kwargs
File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3.6/site-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.6/site-packages/contextvars/__init__.py", line 38, in run
return callable(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/loader/lazy.py", line 1216, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/modules/file.py", line 5409, in check_managed_changes
**kwargs
File "/usr/lib/python3.6/site-packages/salt/modules/file.py", line 4661, in get_managed
**kwargs
File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 261, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/usr/lib/python3.6/site-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 odict_values object has no element 0
Attempts to fix the bug
No attempts to fix yet
Additional context
N/A
The text was updated successfully, but these errors were encountered:
I found your solution in the code. I have now implemented and it is working.
Can you elaborate on the solution? I'm not sophisticated in Python or Salt and just followed the existing configuration and pillar.example file and I'm totally lost
Your setup
Formula commit hash / release tag
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/saltstack-formulas/postfix-formula
fetch = +refs/heads/:refs/remotes/origin/
[branch "master"]
remote = origin
merge = refs/heads/master
Versions reports (master & minion)
salt3004.1
Pillar / config used
Our postfix.sls update file
#!jinja|yaml|gpg
postfix:
config:
relayhost: '[email-smtp.eu-west-2.amazonaws.com]:587'
smtp_sasl_auth_enable: 'yes'
smtp_sasl_security_options: noanonymous
smtp_sasl_password_maps: hash:/etc/postfix/sasl_passwd
sender_canonical_maps: hash:/etc/postfix/canonical
smtp_use_tls: 'yes'
smtp_tls_security_level: encrypt
smtp_tls_note_starttls_offer: 'yes'
smtp_tls_CAfile: /etc/pki/tls/certs/ca-bundle.crt
mapping:
smtp_sasl_password_maps:
- '[email-smtp.eu-west-2.amazonaws.com]:25': xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- '[email-smtp.eu-west-2.amazonaws.com]:465': xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- '[email-smtp.eu-west-2.amazonaws.com]:587': xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bug details
Describe the bug
In Python 2, calling the "values" method of a dictionary returned a list that then could be accessed using an index, but in Python 3 the "values" method returns a iterable object that can't be indexed.
Steps to reproduce the bug
Salt-3004.1 server
Salt-minion linux 7.9
github postfix formulas
Expected behaviour
You will get the same output as I did
Attempts to fix the bug
No attempts to fix yet
Additional context
N/A
The text was updated successfully, but these errors were encountered: