Re: [Gluster-devel] Chnage in exit codes of #gluster volume heal command

2014-05-28 Thread James
On Wed, May 28, 2014 at 6:38 AM, Vikhyat Umrao vum...@redhat.com wrote:
 Hi,

 Can we change the exit codes of #gluster volume heal command if fields like
 `to be healed`, `heal-failed` and `split-brain` have non zero values.
 It will help in a monitoring script to capture the heal details.

 Please let me know your inputs.
I have the same question Pranith has.

In addition, I would recommend considering using --xml and that
picking out the field you want to look at with a quick xml parser, and
then going with that directly. More stable than watching for a
specific return code.

An example of how to parse the xml can be found in:
https://github.com/purpleidea/puppet-gluster/blob/master/files/xml.py
(although there are surely other better ways too!)

HTH
James

 Thanks,
 Vikhyat
___
Gluster-devel mailing list
Gluster-devel@gluster.org
http://supercolony.gluster.org/mailman/listinfo/gluster-devel


Re: [Gluster-devel] Chnage in exit codes of #gluster volume heal command

2014-05-28 Thread Jeff Darcy
 In addition, I would recommend considering using --xml and that
 picking out the field you want to look at with a quick xml parser, and
 then going with that directly. More stable than watching for a
 specific return code.

Parsing XML to get one bit of information doesn't seem like a great
idea.  If the script needs exact counts then sure, parse away, but if
all it needs to know is whether any are non-zero then what's wrong
with having that reflected in the exit code?  That's far easier for a
script to interpret, and there's plenty of precedent for using exit
codes this way.
___
Gluster-devel mailing list
Gluster-devel@gluster.org
http://supercolony.gluster.org/mailman/listinfo/gluster-devel


Re: [Gluster-devel] Chnage in exit codes of #gluster volume heal command

2014-05-28 Thread James
On Wed, May 28, 2014 at 1:10 PM, Jeff Darcy jda...@redhat.com wrote:
 In addition, I would recommend considering using --xml and that
 picking out the field you want to look at with a quick xml parser, and
 then going with that directly. More stable than watching for a
 specific return code.

 Parsing XML to get one bit of information doesn't seem like a great
 idea.  If the script needs exact counts then sure, parse away, but if
 all it needs to know is whether any are non-zero then what's wrong
 with having that reflected in the exit code?  That's far easier for a
 script to interpret, and there's plenty of precedent for using exit
 codes this way.


Parsing an exit code for 2 vs. 4 instead of 2 vs. zero and then doing
something based on that IMO is a bit flimsy.
I agree with checking if a code is non-zero is highly useful.
___
Gluster-devel mailing list
Gluster-devel@gluster.org
http://supercolony.gluster.org/mailman/listinfo/gluster-devel