Bug 1941240 - The 'hammer ping' Command Returns A 0 Exit Code Even With Failed Service
Summary: The 'hammer ping' Command Returns A 0 Exit Code Even With Failed Service
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.8.0
Hardware: x86_64
OS: Linux
high
medium vote
Target Milestone: 6.10.0
Assignee: Oleh Fedorenko
QA Contact: Shweta Singh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-21 01:47 UTC by Bernie Hoefer
Modified: 2021-07-28 10:08 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 30496 0 Normal Closed hammer ping returns 0 even when services are in a failed state 2021-04-07 15:10:31 UTC

Description Bernie Hoefer 2021-03-21 01:47:51 UTC
Description of problem:

The 'hammer ping' command returns a 0 exit code even with a failed service.


Version-Release number of selected component (if applicable):

tfm-rubygem-hammer_cli-2.1.2-1.el7sat.noarch


How reproducible:

1. Stop a service.
   # satellite-maintain service stop --only rh-mongodb34-mongod.service

2. Execute the command; note that there are FAIL statuses.

   # hammer ping
   database:         
       Status:          ok
       Server Response: Duration: 0ms
   candlepin:        
       Status:          ok
       Server Response: Duration: 55ms
   candlepin_events: 
       Status:          ok
       message:         0 Processed, 0 Failed
       Server Response: Duration: 0ms
   candlepin_auth:   
       Status:          ok
       Server Response: Duration: 40ms
   katello_events:   
       Status:          ok
       message:         0 Processed, 0 Failed
       Server Response: Duration: 0ms
   pulp:             
       Status:          FAIL
       Server Response: Message: Pulp database connection issue at https://satellite.localdomain/pulp/api/v2.
   pulp_auth:        
       Status:          FAIL
       Server Response: Message: Skipped pulp_auth check after failed pulp check
   foreman_tasks:    
       Status:          ok
       Server Response: Duration: 5ms

3. Check the exit code.

   # echo $?
   0


Actual results:

Exit code is "0".


Expected results:

Exit code should be non-zero.


Additional info:

This seems this worked in the past; please reference:

  Bug 1054362 - [RFE] Ping command sbould return status
  based on backend services being up or down
  [https://bugzilla.redhat.com/show_bug.cgi?id=1054362]

  Bug 1094826 - Hammer ping command returns wrong return
  code
  [https://bugzilla.redhat.com/show_bug.cgi?id=1094826]

Comment 1 Oleh Fedorenko 2021-04-07 15:10:30 UTC
Connecting redmine issue https://projects.theforeman.org/issues/30496 from this bug

Comment 2 Bryan Kearney 2021-04-13 10:14:42 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30496 has been resolved.


Note You need to log in before you can comment on or make changes to this bug.