mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Merge pull request #54537 from garethgreenaway/2019_2_1_port_51856
[master] Porting #51856 to master
This commit is contained in:
commit
5e9c2c1935
@ -4501,6 +4501,22 @@ def replace(name,
|
||||
When using YAML multiline string syntax in ``pattern:``, make sure to
|
||||
also use that syntax in the ``repl:`` part, or you might loose line
|
||||
feeds.
|
||||
|
||||
When regex capture groups are used in ``pattern:``, their captured value is
|
||||
available for reuse in the ``repl:`` part as a backreference (ex. ``\1``).
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
add_login_group_to_winbind_ssh_access_list:
|
||||
file.replace:
|
||||
- name: '/etc/security/pam_winbind.conf'
|
||||
- pattern: '^(require_membership_of = )(.*)$'
|
||||
- repl: '\1\2,append-new-group-to-line'
|
||||
|
||||
.. note::
|
||||
|
||||
The ``file.replace`` state uses Python's ``re`` module.
|
||||
For more advanced options, see https://docs.python.org/2/library/re.html
|
||||
'''
|
||||
name = os.path.expanduser(name)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user