Mailing List Archive

Issues found in Apache resource agent
Hi,

I was recently using the Apache resource agent, and discovered a few
problems:

The exit code from grep was used directly as an OCF exit code.
It is NOT an OCF exit code, and should not be directly used
in this way.
This caused a "not running" error to become a generic error.
Pacemaker reacts very differently to the two kinds of errors.

This code occurred in two places.

The resource agent used OCF_CHECK_LEVEL improperly.

The specification says that if you receive an OCF_CHECK_LEVEL which you
do not support, you are required to interpret it as the next lower
supported value for OCF_CHECK_LEVEL.

In effect, there are no invalid OCF_CHECK_LEVEL values. The Apache
agent declared all values but one to be errors. This is not the correct
behavior.

--
Alan Robertson <alanr@unix.sh> - @OSSAlanR

"Openness is the foundation and preservative of friendship... Let me claim from you at all times your undisguised opinions." - William Wilberforce
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Re: Issues found in Apache resource agent [ In reply to ]
Hi Alan,

On Mon, Aug 27, 2012 at 10:51:15AM -0600, Alan Robertson wrote:
> Hi,
>
> I was recently using the Apache resource agent, and discovered a few
> problems:
>
> The exit code from grep was used directly as an OCF exit code.
> It is NOT an OCF exit code, and should not be directly used
> in this way.

I guess you mean the greps in monitor_apache_extended and
monitor_apache_basic? These lines:

267 $whattorun "$test_url" | grep -Ei "$test_regex" > /dev/null
277 ${ourhttpclient}_func "$STATUSURL" | grep -Ei "$TESTREGEX" > /dev/null

> This caused a "not running" error to become a generic error.

These lines are invoked _only_ in case it was previously
established that the apache server is running. So, they should
return OCF_ERR_GENERIC if the test fails. grep exits with code 1
which matches OCF_ERR_GENERIC. But indeed the OCF error code
should be returned explicitely.

> Pacemaker reacts very differently to the two kinds of errors.
>
> This code occurred in two places.
>
> The resource agent used OCF_CHECK_LEVEL improperly.
>
> The specification says that if you receive an OCF_CHECK_LEVEL which you
> do not support, you are required to interpret it as the next lower
> supported value for OCF_CHECK_LEVEL.
>
> In effect, there are no invalid OCF_CHECK_LEVEL values. The Apache
> agent declared all values but one to be errors. This is not the correct
> behavior.

OK. That somehow slipped while I had been reading the OCF standard.

BTW, it'd be great if nginx shared some code with apache. The
latter has already been split into three scripts.

Cheers,

Dejan

> --
> Alan Robertson <alanr@unix.sh> - @OSSAlanR
>
> "Openness is the foundation and preservative of friendship... Let me claim from you at all times your undisguised opinions." - William Wilberforce
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/