Bug #29699
closedForeman-maintain ends with wrong exit code.
Description
foreman-maintain should not give exit code 1 if the check fails with warning status.
~~~
[root@foreman ~]# foreman-maintain health check --label disk-performance
Running ForemanMaintain::Scenario::FilteredScenario
================================================================================
Check for recommended disk speed of pulp, mongodb, pgsql dir.:
\ Finished
Disk speed : 12 MB/sec [WARNING]
Slow disk detected /var/lib/pulp mounted on /dev/mapper/rhel-root.
Actual disk speed: 12 MB/sec
Expected disk speed: 60 MB/sec.
WARNING: Low disk speed might have a negative impact on the system.
See https://access.redhat.com/solutions/3397771 before proceeding
--------------------------------------------------------------------------------
Scenario [ForemanMaintain::Scenario::FilteredScenario] failed.
The following steps ended up in warning state:
[disk-performance]
The steps in warning state itself might not mean there is an error,
but it should be reviewed to ensure the behavior is expected
[root@foreman ~]# echo $?
1
~~~
As the above command/process is completed without any ERROR it should return the exit code 0.
Updated by Suraj Patil over 4 years ago
Also, observed that in the logs exit code is not printed.
~~~
I, [2020-05-05 14:25:14+0530 #14104] INFO -- : Slow disk detected /var/lib/pulp: 12 MB/sec.
I, [2020-05-05 14:25:14+0530 #14104] INFO -- : --- Execution step 'Check for recommended disk speed of pulp, mongodb, pgsql dir.' finished ---
I, [2020-05-05 14:25:14+0530 #14104] INFO -- : === Scenario 'ForemanMaintain::Scenario::FilteredScenario' finished ===
I, [2020-05-05 14:25:14+0530 #14104] INFO -- : foreman-maintain command finished with
~~~
Code snippet
---
def log_exit_code_info(exit_code)
logger.info("foreman-maintain command finished with #{exit_code}")
end
---
Updated by Suresh Thirugnanasambandan over 4 years ago
- Related to Tracker #29643: Capsule upgrade playbook tracker added
Updated by The Foreman Bot over 4 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman_maintain/pull/375 added
Updated by Anonymous over 4 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman_maintain|75c43303035596c767e396385e4c44ee267e7203.