Apply fixes uniformly.

Working on a monitoring system, I was getting a version of check_graphite.rb configured (it’s an upgraded version of the one that’s stock, in that it adds some new features).

Everything was going well.. then I noticed the graphing component wasn’t picking up and .. well, graphing.  The metric name that was being output was ‘true’, vs the value I had set (in this case ‘battles’).

I looked over the code.  Oh, did I ever.  Several hours of looking, testing, adding debug statements… nothing.  I walked away frustrated.

A few hours later I came back to it and went .. huh?  Here’s the code

o.on('-s', '--shortname', 'Metric short identifier (required for performance data)') { |oc| options[:shortname] = oc }

Looks pretty sane… except I realized it was actually supposed to be:

o.on('-s', '--shortname NAME', 'Metric short identifier (required for performance data)') { |oc| options[:shortname] = oc }

If you don’t add NAME (or some keyword).. it ignores any values applied to the flag, and returns true if set.  Ok then, feeling like an idiot (since i wrote this code)… I’d better fix my own copy of this, since i’d written mine first, then made a copy for work.

I open my copy… it’s already fixed. Has been for a long time.  Not only that, a second typo is also fixed.

The moral of this, apply changes uniformly.