Skip to content

Commit

Permalink
Use quiet loglevel when applying the pre_check patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Legrems committed Feb 12, 2024
1 parent 2b364c9 commit 828440f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions salt/modules/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3239,7 +3239,7 @@ def search(path, pattern, flags=8, bufsize=1, ignore_if_missing=False, multiline
)


def patch(originalfile, patchfile, options="", dry_run=False):
def patch(originalfile, patchfile, options="", dry_run=False, output_loglevel="info"):
"""
.. versionadded:: 0.10.4
Expand Down Expand Up @@ -3331,7 +3331,7 @@ def patch(originalfile, patchfile, options="", dry_run=False):
else:
cmd.append(originalfile)

return __salt__["cmd.run_all"](cmd, python_shell=False)
return __salt__["cmd.run_all"](cmd, python_shell=False, output_loglevel=output_loglevel)


def contains(path, text):
Expand Down
6 changes: 3 additions & 3 deletions salt/states/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -7403,12 +7403,12 @@ def patch(
)
return result

def _patch(patch_file, options=None, dry_run=False):
def _patch(patch_file, options=None, dry_run=False, output_loglevel="info"):
patch_opts = copy.copy(sanitized_options)
if options is not None:
patch_opts.extend(options)
return __salt__["file.patch"](
name, patch_file, options=patch_opts, dry_run=dry_run
name, patch_file, options=patch_opts, dry_run=dry_run, output_loglevel=output_loglevel,
)

if reject_file is not None:
Expand All @@ -7430,7 +7430,7 @@ def _patch(patch_file, options=None, dry_run=False):
if is_dir and strip is not None:
patch_opts.append(f"-p{strip}")

pre_check = _patch(patch_file, patch_opts)
pre_check = _patch(patch_file, patch_opts, output_loglevel="quiet")
if pre_check["retcode"] != 0:
if not os.path.exists(patch_rejects) or os.path.getsize(patch_rejects) == 0:
ret["comment"] = pre_check["stderr"]
Expand Down

0 comments on commit 828440f

Please sign in to comment.