Returns the setting for the specified config value. The priority for matches is the same as in :py:func:`config.get `, only this function does not recurse into nested data structures. Another difference between this function and :py:func:`config.get <sal
(
value,
default=None,
omit_opts=False,
omit_grains=False,
omit_pillar=False,
omit_master=False,
omit_all=False,
wildcard=False,
)
| 137 | |
| 138 | |
| 139 | def option( |
| 140 | value, |
| 141 | default=None, |
| 142 | omit_opts=False, |
| 143 | omit_grains=False, |
| 144 | omit_pillar=False, |
| 145 | omit_master=False, |
| 146 | omit_all=False, |
| 147 | wildcard=False, |
| 148 | ): |
| 149 | """ |
| 150 | Returns the setting for the specified config value. The priority for |
| 151 | matches is the same as in :py:func:`config.get <salt.modules.config.get>`, |
| 152 | only this function does not recurse into nested data structures. Another |
| 153 | difference between this function and :py:func:`config.get |
| 154 | <salt.modules.config.get>` is that it comes with a set of "sane defaults". |
| 155 | To view these, you can run the following command: |
| 156 | |
| 157 | .. code-block:: bash |
| 158 | |
| 159 | salt '*' config.option '*' omit_all=True wildcard=True |
| 160 | |
| 161 | default |
| 162 | The default value if no match is found. If not specified, then the |
| 163 | fallback default will be an empty string, unless ``wildcard=True``, in |
| 164 | which case the return will be an empty dictionary. |
| 165 | |
| 166 | omit_opts : False |
| 167 | Pass as ``True`` to exclude matches from the minion configuration file |
| 168 | |
| 169 | omit_grains : False |
| 170 | Pass as ``True`` to exclude matches from the grains |
| 171 | |
| 172 | omit_pillar : False |
| 173 | Pass as ``True`` to exclude matches from the pillar data |
| 174 | |
| 175 | omit_master : False |
| 176 | Pass as ``True`` to exclude matches from the master configuration file |
| 177 | |
| 178 | omit_all : True |
| 179 | Shorthand to omit all of the above and return matches only from the |
| 180 | "sane defaults". |
| 181 | |
| 182 | .. versionadded:: 3000 |
| 183 | |
| 184 | wildcard : False |
| 185 | If used, this will perform pattern matching on keys. Note that this |
| 186 | will also significantly change the return data. Instead of only a value |
| 187 | being returned, a dictionary mapping the matched keys to their values |
| 188 | is returned. For example, using ``wildcard=True`` with a ``key`` of |
| 189 | ``'foo.ba*`` could return a dictionary like so: |
| 190 | |
| 191 | .. code-block:: python |
| 192 | |
| 193 | {'foo.bar': True, 'foo.baz': False} |
| 194 | |
| 195 | .. versionadded:: 3000 |
| 196 |
no test coverage detected