mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #30406 from ZipRecruiter/check-cmd-example
Add an example of how to use file.managed/check_cmd
This commit is contained in:
commit
f9b3f3f038
1 changed files with 15 additions and 0 deletions
|
@ -1362,6 +1362,21 @@ def managed(name,
|
|||
The specified command will be run with the managed file as an argument.
|
||||
If the command exits with a nonzero exit code, the state will fail and
|
||||
no changes will be made to the file.
|
||||
|
||||
For example, the following could be used to verify sudoers before making
|
||||
changes:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
/etc/sudoers:
|
||||
file.managed:
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 0440
|
||||
- source: salt://sudoers/files/sudoers.jinja
|
||||
- template: jinja
|
||||
- check_cmd: /usr/sbin/visudo -c -f
|
||||
|
||||
'''
|
||||
name = os.path.expanduser(name)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue