ipatests: Ignore warnings on failed to read files on tarring

There are tons of useless warnings about missing files on collecting
logs, such as:

```
tar: /var/log/ipaserver-kra-install.log: Warning: Cannot stat: No such file or directory
tar: /var/log/ipaepn.log: Warning: Cannot stat: No such file or directory
tar: /etc/NetworkManager/NetworkManager.conf: Warning: Cannot stat: No such file or directory
tar: /var/log/ipabackup.log: Warning: Cannot stat: No such file or directory
tar: /var/log/iparestore.log: Warning: Cannot stat: No such file or directory
...

```

Since `--ignore-failed-read` option is passed to tar the caller
doesn't care about not readable(mostly missing) files and these warnings
may be filtered out.

This improves the readability of test logs.

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Stanislav Levin authored and Alexander Bokovoy committed 2021-05-25 10:45:49 +03:00
1 parent 3889d8654a
commit afef09ccba
3 files changed
+13 -4

No files matched your search

@@ -14,6 +14,7 @@ function collect_logs() {
printf "Collecting logs\n"
journalctl -b --no-pager > systemd_journal.log
tar --ignore-failed-read -czf "$out_file" \
--warning=no-failed-read \
/var/log/dirsrv \
"$HTTPD_LOGDIR" \
/var/log/ipa* \
+1 -1
View File
@@ -93,7 +93,7 @@ steps:
printf "SECCOMP:\n"
grep ' SECCOMP ' "$HOST_JOURNAL" && \
emit_warning "There are reported SECCOMP syscalls. Please, check the logs."
tar --ignore-failed-read -czf "$HOST_JOURNAL_PATH" "$HOST_JOURNAL"
tar -czf "$HOST_JOURNAL_PATH" "$HOST_JOURNAL"
condition: succeededOrFailed()
displayName: Host's systemd journal
+11 -3
View File
@@ -218,9 +218,17 @@ def collect_logs(name, logs_dict, logfile_dir=None, beakerlib_plugin=None):
tmpname = cmd.stdout_text.strip()
# Tar up the logs on the remote server
cmd = host.run_command(
['tar', 'cJvf', tmpname, '--ignore-failed-read',
'--dereference'] + logs,
log_stdout=False, raiseonerr=False)
[
"tar",
"cJvf",
tmpname,
"--ignore-failed-read",
"--warning=no-failed-read",
"--dereference",
] + logs,
log_stdout=False,
raiseonerr=False,
)
if cmd.returncode:
logger.warning('Could not collect all requested logs')
# fetch tar file