Tomas Golembiovsky has uploaded a new change for review.
Change subject: vdsm: report correct exit value in vdsm-logrotate ......................................................................
vdsm: report correct exit value in vdsm-logrotate
The exit code was reported improperly. If all but the last command had failed we would still return 0. Now we are reporting exit code of last failed command or 0 when all exited successfully.
Change-Id: I29df6cac36c64be2bf20337ab096ec471d864ca5 Signed-off-by: Tomáš Golembiovský tgolembi@redhat.com --- M vdsm/vdsm-logrotate 1 file changed, 8 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/65603/1
diff --git a/vdsm/vdsm-logrotate b/vdsm/vdsm-logrotate index a29cbe5..e44e079 100755 --- a/vdsm/vdsm-logrotate +++ b/vdsm/vdsm-logrotate @@ -17,17 +17,19 @@
if [ -d /var/log/core ] ; then /usr/bin/find /var/log/core -type f -name '*xz' -mtime +7 -exec /bin/rm -f '{}' ; - EXITVALUE=$? - if [ $EXITVALUE != 0 ]; then - /usr/bin/logger -t logrotate "ALERT clean old core files exited abnormally with [$EXITVALUE]" + RET=$? + if [ $RET != 0 ]; then + /usr/bin/logger -t logrotate "ALERT clean old core files exited abnormally with [$RET]" + EXITVALUE=$RET fi fi
if [ -d /var/log/vdsm/import ] ; then /usr/bin/find /var/log/vdsm/import -type f -mtime +30 -exec /bin/rm -f '{}' ; - EXITVALUE=$? - if [ $EXITVALUE != 0 ]; then - /usr/bin/logger -t logrotate "ALERT clean of old import log files exited abnormally with [$EXITVALUE]" + RET=$? + if [ $RET != 0 ]; then + /usr/bin/logger -t logrotate "ALERT clean of old import log files exited abnormally with [$RET]" + EXITVALUE=$RET fi fi
gerrit-hooks has posted comments on this change.
Change subject: vdsm: report correct exit value in vdsm-logrotate ......................................................................
Patch Set 1:
* Update Tracker::IGNORE, no bug url/s found * Check Bug-Url::IGNORE, not relevant for branch: master * Check Public Bug::WARN, no public bug url found * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
Tomas Golembiovsky has posted comments on this change.
Change subject: vdsm: report correct exit value in vdsm-logrotate ......................................................................
Patch Set 1:
CI failure unrelated:
stderr: fatal: Unable to look up gerrit.ovirt.org (port 9418) (Name or service not known)
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has posted comments on this change.
Change subject: vdsm: report correct exit value in vdsm-logrotate ......................................................................
Patch Set 2:
(1 comment)
https://gerrit.ovirt.org/#/c/65603/2/vdsm/vdsm-logrotate File vdsm/vdsm-logrotate:
PS2, Line 17: ((errors+1) nit: strictly speaking, this requires /bin/bash
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has posted comments on this change.
Change subject: vdsm: report correct exit value in vdsm-logrotate ......................................................................
Patch Set 2: Code-Review+2
(2 comments)
https://gerrit.ovirt.org/#/c/65603/2/vdsm/vdsm-logrotate File vdsm/vdsm-logrotate:
PS2, Line 7:
We do not need this space. Please remove.
but it's not strictly related to this patch, so it should not block it.
PS2, Line 17: ((errors+1)
I don't think so. This type of arithmetic expansion is defined in POSIX.
You are correct. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag...
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has posted comments on this change.
Change subject: vdsm: report correct exit value in vdsm-logrotate ......................................................................
Patch Set 3: Continuous-Integration+1
unrelated failure
FAIL: test_continue_after_failures(<function monotonic_time at 0x7f3014fe52a8>) (scheduleTests.SchedulerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/workspace/vdsm_master_check-patch-fc24-x86_64/vdsm/tests/testlib.py", line 135, in wrapper return f(self, *args) File "/home/jenkins/workspace/vdsm_master_check-patch-fc24-x86_64/vdsm/tests/scheduleTests.py", line 84, in test_continue_after_failures self.assertTrue(task.call_time is not None) AssertionError: False is not true -------------------- >> begin captured logging << -------------------- 2016-11-24 06:26:17,674 DEBUG (MainThread) [Scheduler] Starting scheduler Scheduler (schedule:98) 2016-11-24 06:26:17,675 DEBUG (Scheduler) [Scheduler] started (schedule:140) 2016-11-24 06:26:18,342 ERROR (Scheduler) [Scheduler] Unhandled exception in <scheduleTests.FailingTask object at 0x7f3005b69290> (schedule:215) Traceback (most recent call last): File "/home/jenkins/workspace/vdsm_master_check-patch-fc24-x86_64/vdsm/lib/vdsm/schedule.py", line 213, in _execute self._callable() File "/home/jenkins/workspace/vdsm_master_check-patch-fc24-x86_64/vdsm/tests/scheduleTests.py", line 220, in __call__ raise Exception("This task is broken") Exception: This task is broken
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has submitted this change and it was merged.
Change subject: vdsm: report correct exit value in vdsm-logrotate ......................................................................
vdsm: report correct exit value in vdsm-logrotate
The exit code was reported improperly. When all but the last command had failed, we would still return 0.
Let's return 1 when any number of commands fails and 0 if all succeed.
Change-Id: I29df6cac36c64be2bf20337ab096ec471d864ca5 Signed-off-by: Tomáš Golembiovský tgolembi@redhat.com --- M vdsm/vdsm-logrotate 1 file changed, 9 insertions(+), 1 deletion(-)
Approvals: Nir Soffer: Looks good to me, but someone else must approve Dan Kenigsberg: Looks good to me, approved; Passed CI tests Tomas Golembiovsky: Verified
Objections: Jenkins CI: Failed CI tests
vdsm-patches@lists.fedorahosted.org