[katello-devel] Q - should cmd line katello give non-zero exit status for this?
Mike McCune
mmccune at redhat.com
Tue Nov 1 15:57:44 UTC 2011
On 11/01/2011 08:54 AM, Cliff Perry wrote:
>
> [root at dhcp77-176 ~]# katello --username admin --password admin ping
> -------------------------------------------------------------------------------------------------------------------------------------------
> Katello Status
>
> Status Service Result Duration Message
> -------------------------------------------------------------------------------------------------------------------------------------------
> ok
> candlepin ok 45ms
> pulp_auth ok 102ms
> pulp ok 72ms
> candlepin_auth ok 44ms
> [root at dhcp77-176 ~]# echo $?
> 0
> [root at dhcp77-176 ~]# service tomcat6 stop
> Stopping tomcat6: [ OK ]
> [root at dhcp77-176 ~]# katello --username admin --password admin ping
> -------------------------------------------------------------------------------------------------------------------------------------------
> Katello Status
>
> Status Service Result Duration Message
>
> -------------------------------------------------------------------------------------------------------------------------------------------
> fail
>
> candlepin fail Connection refused -
> connect(2)
> pulp_auth ok 60ms
>
> pulp ok 51ms
>
> candlepin_auth fail Connection refused -
> connect(2)
> [root at dhcp77-176 ~]# echo $?
> 0
> [root at dhcp77-176 ~]#
>
> So the command ran fine, but it reported failures within the services it
> is reporting.
>
> *IF* it returned non-zero we could automate easier a check at the end of
> installation - without looking at the strings.
>
> So, should the command exit 0 for success, or 1 for failure in this use
> case? :)
I'd argue yes, it should return non-zero if any of the ping checks fail.
Simple way to determine with that ping command if something is broken
if you wanted to cron it or use it in some other script.
Mike
More information about the katello-devel
mailing list