On 04/16/13 06:46, Andreas Mock wrote:
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.

This is an oversight on my part, I've updated the code to check retval and return an error. Currently I'm not passing through the full error code (I'm only returning 0 on success and 1 on failure). However, if you think it would be useful to have this information I would be happy to look at it and see what I can do. I'm planning on eventually having pcs interpret the crm_resource error code and provide a more user friendly output instead of just a return code.

Thanks,
Chris


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




_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org



_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org

Reply via email to