Project

General

Profile

Bug #29699

Foreman-maintain ends with wrong exit code.

Added by Suraj Patil over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
medium
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

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.


Related issues

Related to Foreman Remote Execution - Tracker #29643: Capsule upgrade playbook trackerClosed

Associated revisions

Revision 75c43303 (diff)
Added by Suraj Patil about 2 years ago

Fixes #29699 - Fix exit code for warning to 78

Along with the fix, added new section for special exit codes in readme file.

History

#1 Updated by Suraj Patil over 2 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
---

#2 Updated by Suresh Thirugnanasambandan over 2 years ago

#3 Updated by Suraj Patil about 2 years ago

  • Assignee set to Suraj Patil

#4 Updated by The Foreman Bot about 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_maintain/pull/375 added

#5 Updated by Anonymous about 2 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF