MCPcopy
hub / github.com/saltstack/salt / patch

Function patch

salt/states/file.py:7539–7967  ·  view source on GitHub ↗

Ensure that a patch has been applied to the specified file or directory .. versionchanged:: 2019.2.0 The ``hash`` and ``dry_run_first`` options are now ignored, as the logic which determines whether or not the patch has already been applied no longer requires them.

(
    name,
    source=None,
    source_hash=None,
    source_hash_name=None,
    skip_verify=False,
    template=None,
    context=None,
    defaults=None,
    options="",
    reject_file=None,
    strip=None,
    saltenv=None,
    **kwargs,
)

Source from the content-addressed store, hash-verified

7537
7538
7539def patch(
7540 name,
7541 source=None,
7542 source_hash=None,
7543 source_hash_name=None,
7544 skip_verify=False,
7545 template=None,
7546 context=None,
7547 defaults=None,
7548 options="",
7549 reject_file=None,
7550 strip=None,
7551 saltenv=None,
7552 **kwargs,
7553):
7554 """
7555 Ensure that a patch has been applied to the specified file or directory
7556
7557 .. versionchanged:: 2019.2.0
7558 The ``hash`` and ``dry_run_first`` options are now ignored, as the
7559 logic which determines whether or not the patch has already been
7560 applied no longer requires them. Additionally, this state now supports
7561 patch files that modify more than one file. To use these sort of
7562 patches, specify a directory (and, if necessary, the ``strip`` option)
7563 instead of a file.
7564
7565 .. note::
7566 A suitable ``patch`` executable must be available on the minion. Also,
7567 keep in mind that the pre-check this state does to determine whether or
7568 not changes need to be made will create a temp file and send all patch
7569 output to that file. This means that, in the event that the patch would
7570 not have applied cleanly, the comment included in the state results will
7571 reference a temp file that will no longer exist once the state finishes
7572 running.
7573
7574 name
7575 The file or directory to which the patch should be applied
7576
7577 source
7578 The patch file to apply
7579
7580 .. versionchanged:: 2019.2.0
7581 The source can now be from any file source supported by Salt
7582 (``salt://``, ``http://``, ``https://``, ``ftp://``, etc.).
7583 Templating is also now supported.
7584
7585 source_hash
7586 Works the same way as in :py:func:`file.managed
7587 <salt.states.file.managed>`.
7588
7589 .. versionadded:: 2019.2.0
7590
7591 source_hash_name
7592 Works the same way as in :py:func:`file.managed
7593 <salt.states.file.managed>`
7594
7595 .. versionadded:: 2019.2.0
7596

Calls 11

_patchFunction · 0.85
formatMethod · 0.80
debugMethod · 0.80
managedFunction · 0.70
existsMethod · 0.45
appendMethod · 0.45
setdefaultMethod · 0.45
parseMethod · 0.45
copyMethod · 0.45
removeMethod · 0.45
errorMethod · 0.45