Repository navigation
Description
Description
The new module.run format which will be enforced on the release of 3005 throws a little bit of a monkey wrench in the pyobjects renderer. The new format expects the name of the module to run as one of the keyword arguments, but it can't be listed explicitly in the pyobjects format because of the dot (.) in the name.
Attempting to run something like this:
#!pyobjects
user = ["susan"]
Module.run("pyobject_shadow", shadow.lock_password=user)
will fail with an error like this:
local:
Data failed to compile:
----------
Rendering SLS py_shadow failed, render error: keyword can't be an expression (<string>, line 4)
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/salt/state.py", line 4034, in render_state
context=context,
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/pyobjects.py", line 495, in render
exec(final_template, _globals)
File "<string>", line 4
SyntaxError: keyword can't be an expression
However, creating a kwargs dictionary seems to work just fine:
#!pyobjects
lock_kwargs = {"shadow.lock_password": ["susan"]}
Module.run("pyobject_shadow", **lock_kwargs)
Suggested Fix
A brief section with code examples such as above should point folks in the right direction.
Location or format of documentation
Might be a good fit in either or both of the pyobjects docs and module.run docs.
Additional context
This probably won't affect many people as I suspect the intersection of people using both pyobjects and module.run is small.
Activity
whytewolf commentedon Mar 22, 2022
for clarification. per #58763 neither syntax of
module.runis going away. we are instead going to do a detect and run style and make use_superseded a noopnicholasmhughes commentedon Mar 22, 2022
Oh nice! Thanks for letting me know @whytewolf
dwoz commentedon Oct 15, 2026
Thanks for the original report. This issue has been open for more than three years without recent activity and carries a severity label below
severity-high. As part of a backlog cleanup, we're closing older low- and medium-severity issues so triage can focus on reports against currently supported releases.Closing isn't a judgement that the problem wasn't real — only that the codebase has moved through several releases since this was filed, and much of the surrounding code has changed.
If you — or anyone else — can still reproduce this on the 3008.x LTS release, please leave a comment with a reproduction and a maintainer will reopen. The original reporter can also reopen directly.
dwoz commentedon Oct 17, 2026
Reopening — there is an open PR tracking a fix for this: #69560.
dwoz commentedon Oct 28, 2026
Closing — consolidated into #70585. The checkbox for this item is in the appropriate theme section of that tracker. Please pick up the sub-item there.