Fixed trim_output logic in archive.extracted state

This commit is contained in:
Proskurin Kirill 2020-01-31 19:47:03 +00:00 committed by Daniel Wozniak
parent dcde50d4ee
commit 3548fc300a
2 changed files with 9 additions and 3 deletions

View file

@ -232,6 +232,7 @@ Versions are `MAJOR.PATCH`.
- [#55823](https://github.com/saltstack/salt/pull/55823) - Fix issue with overly long names in the LGPO module - [@twangboy](https://github.com/twangboy)
- [#55843](https://github.com/saltstack/salt/pull/55843) - Fixed `file.mkdir` to respect `test=True` - [@mchugh19](https://github.com/mchugh19)
- [#55845](https://github.com/saltstack/salt/pull/55845) - Fixed logging to return multiprocessing queue if it's already set - [@s0undt3ch](https://github.com/s0undt3ch)
- [#56041](https://github.com/saltstack/salt/pull/56041) - Fixed trim_output logic in archive.extracted state - [@Oloremo](https://github.com/Oloremo)
### Added

View file

@ -1508,9 +1508,13 @@ def extracted(
ret["changes"] = results
return ret
if _is_bsdtar():
files = results["stderr"].splitlines()
files = results['stderr'].splitlines()
if trim_output:
files = files[:trim_output]
else:
files = results["stdout"].splitlines()
files = results['stdout'].splitlines()
if trim_output:
files = files[:trim_output]
if not files:
files = "no tar output so far"
except CommandExecutionError as exc:
@ -1616,7 +1620,8 @@ def extracted(
salt.utils.url.redact_http_basic_auth(source_match), name,
)
_add_explanation(ret, source_hash_trigger, contents_missing)
ret["result"] = True
ret['comment'] += '. Output was trimmed to {} number of lines'.format(trim_output)
ret['result'] = True
else:
ret["result"] = False