Bug #18333
closedkatello-backup returns with wrong exit code when failing
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1323607
Description of problem:
The katello-backup script calls tar to create backups. If tar is failing, i.e. No space left on device or i.e by just killing the tar process, the backup script returns zero.
As a consequence, the failure of the backups is not reported, in contrary all is looking fine. A restore attempt will fail.
Version-Release number of selected component (if applicable):
katello-common-2.2.0.18-1.el7sat.noarch
How reproducible:
Always
Steps to Reproduce:
1./usr/bin/katello-backup /to/small/filesystem
2. tar: Removing leading `/' from member names
gzip: stdout: No space left on device
Done.
Backing up mongo db...
tar: Removing leading `/' from member names
Done.
[..]
- BACKUP Complete, contents can be found in: /backup **
[root@sat ~]#
3. echo $?
Actual results:
0
Expected results:
1 (or anything else non-zero
Additional info:
The script should look something like:
tar --selinux -czf config_files.tar.gz ${CONFIGS[*]} || exit $? to catch the exit code of tar