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: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.8.0
Hardware: x86_64
OS: Linux
high
medium
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-11-16 14:39 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 14:39:05 UTC
Target Upstream Version:
Embargoed:


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
Red Hat Product Errata RHBA-2021:4701 0 None None None 2021-11-16 14:39:12 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.

Comment 8 errata-xmlrpc 2021-11-16 14:39:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Satellite 6.10 Satellite Tools Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4701


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