How to pass argument to dict function in salt
I need to use
pip.installed
in salt and pass the argument
env_vars
with a few parameters that must eventually be translated into a python dictionary. It's ok if there is one parameter and the argument was expecting an argument of type other than dictionary i, then he could pass it like this:
pip.installed:
- env_vars: my_var
But I need to pass a dict and im not sure how.
Should there be a construction like:
pip.installed:
- env_vars:
- my_var1: var_value
- my_var2: var_value2
And how am I supposed to check that my configuration actually displays the correct form?
+3
source to share
2 answers
This answer is incorrect, Salt will issue a warning.
pip.installed:
- env_vars:
my_var1: var_value
my_var2: var_value2
Warnings: 'my_var2' and 'my_var1' are invalid keyword arguments for
'pip.installed'. If you were trying to pass additional data to be
used in a template context, please populate 'context' with 'key:
value' pairs. Your approach will work until Salt Carbon is out.
Please update your state files.
Variables should be nested at another level like this:
pip.installed:
- env_vars:
my_var1: var_value
my_var2: var_value2
+4
source to share