[Pacemaker] pcs: Return code handling not clean

Andreas Mock andreas.mock at web.de
Tue Apr 16 11:46:01 UTC 2013


Hi all,

as I don't really know, where to address this
issue, I do post it here. On the one handside
as an information for guys scripting with the
help of 'pcs' and on the other handside with
the hope that one maintainer is listening
and will have a look at this.

Problem: When cluster is down a 'pcs resource'
shows an error message coming from a subprocess
call of 'crm_resource -L' but exits with an
error code of 0. That's something which can
be improved. Especially while the python code
does have error handling in other paces.

So I guess it is a simple oversight.

Look at the following piece of code in
pcs/resource.py:

915     if len(argv) == 0:
916         args = ["crm_resource","-L"]
917         output,retval = utils.run(args)
918         preg = re.compile(r'.*(stonith:.*)')
919         for line in output.split('\n'):
920             if not preg.match(line) and line != "":
921                 print line
922         return

retval is totally ignored, while being handled on
other places. That leads to the fact that the script
returns with status 0.

Interestingly the error handling of the utils.run call
used all over the module is IMHO a little bit inconsistent.
If I remember correctly Andrew did some efforts in the
past to have a set of return codes comming from the
base cibXXX and crm_XXX tools. (I really don't know
how much they are differentiated). Why not pass them
through?

Best regards
Andreas Mock







More information about the Pacemaker mailing list