Bug 1054362 - [RFE] Ping command sbould return status based on backend services being up or down
Summary: [RFE] Ping command sbould return status based on backend services being up or...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: Adam Price
QA Contact: sthirugn@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-16 17:08 UTC by Bryan Kearney
Modified: 2019-09-26 18:18 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-11 12:21:41 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Bryan Kearney 2014-01-16 17:08:18 UTC
The ping command should return non zero based on what system is down. See the code from the old katello-cli

    def __returnCode(self, status):
        """
        Creates a return code according to returned statuses.
        Error codes (combination by bitwise or):
            candlepin:      2
            candlepin_auth: 4
            pulp:           8
            pulp_auth:     16
        """
        if status['result'].lower() == 'ok':
            return 0

        code = 0
        # pylint: disable=W0612
        for serviceName, serviceStatus in self.__sortedStatuses(status, reverse=True):
            if serviceStatus['result'] != 'ok':
                code += 1
            code = code << 1
        return code

Comment 5 Elyézer Rezende 2014-05-05 17:41:04 UTC
Could not test hammer ping as the nightly installer is failing

# katello-installer -v -d
tput: No value for $TERM and no -T specified
[[32m INFO[0m [34m2014-05-05 12:52:27[0m [36mverbose[0m] Running validation checks
[[31mERROR[0m [34m2014-05-05 12:52:28[0m [36mverbose[0m] "foreman::plugin::discovery::params::install_images" is not a boolean.  It looks to be a String
[[31mERROR[0m [34m2014-05-05 12:52:28[0m [36mverbose[0m] Parameter foreman-plugin-discovery-install-images invalid
Error during configuration, exiting

# hammer ping
Could not load API description from the server
  - is your server down?
  - was "foreman-rake apipie:cache" run on the server when using apipie cache? (typical production settings))
Could not load API description from the server
  - is your server down?
  - was "foreman-rake apipie:cache" run on the server when using apipie cache? (typical production settings))
Error: No such sub-command 'ping'

See: 'hammer --help'
Warning: An error occured while loading module hammer_cli_foreman
Warning: An error occured while loading module hammer_cli_katello

PS.: I'm using katello-deploy script

Comment 7 sthirugn@redhat.com 2014-09-03 14:26:00 UTC
Verified.

# hammer -u admin -p changeme ping
candlepin:      
    Status:          ok
    Server Response: Duration: 30ms
candlepin_auth: 
    Status:          ok
    Server Response: Duration: 32ms
pulp:           
    Status:          ok
    Server Response: Duration: 19ms
pulp_auth:      
    Status:          ok
    Server Response: Duration: 24ms
elasticsearch:  
    Status:          ok
    Server Response: Duration: 31ms
foreman_tasks:  
    Status:          ok
    Server Response: Duration: 0ms

# echo $?
0


Version Tested:
GA Snap 7 - Satellite-6.0.4-RHEL-6-20140829.0

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.23-1.el6_5.noarch
* candlepin-common-1.0.1-1.el6_5.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.9.23-1.el6_5.noarch
* candlepin-tomcat6-0.9.23-1.el6_5.noarch
* elasticsearch-0.90.10-6.el6sat.noarch
* foreman-1.6.0.42-1.el6sat.noarch
* foreman-compute-1.6.0.42-1.el6sat.noarch
* foreman-gce-1.6.0.42-1.el6sat.noarch
* foreman-libvirt-1.6.0.42-1.el6sat.noarch
* foreman-ovirt-1.6.0.42-1.el6sat.noarch
* foreman-postgresql-1.6.0.42-1.el6sat.noarch
* foreman-proxy-1.6.0.30-1.el6sat.noarch
* foreman-selinux-1.6.0.14-1.el6sat.noarch
* foreman-vmware-1.6.0.42-1.el6sat.noarch
* katello-1.5.0-30.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-installer-0.0.62-1.el6sat.noarch
* openldap-2.4.23-34.el6_5.1.x86_64
* openldap-devel-2.4.23-34.el6_5.1.x86_64
* pulp-katello-0.3-4.el6sat.noarch
* pulp-nodes-common-2.4.1-0.5.rc1.el6sat.noarch
* pulp-nodes-parent-2.4.1-0.5.rc1.el6sat.noarch
* pulp-puppet-plugins-2.4.1-0.5.rc1.el6sat.noarch
* pulp-puppet-tools-2.4.1-0.5.rc1.el6sat.noarch
* pulp-rpm-plugins-2.4.1-0.5.rc1.el6sat.noarch
* pulp-selinux-2.4.1-0.5.rc1.el6sat.noarch
* pulp-server-2.4.1-0.5.rc1.el6sat.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
* ruby193-rubygem-runcible-1.1.0-2.el6sat.noarch

Comment 8 Bryan Kearney 2014-09-11 12:21:41 UTC
This was delivered with Satellite 6.0 which was released on 10 September 2014.


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