Re: Perl Modul Nagios::Plugin and extra-opts - request for comments

William Leibzon <[email protected]>
Newsgroups gmane.network.nagios.plugins.devel
Message-ID <CAFCy1Bjs5B=KDysFVkmtfTM0KOb1Yg4eiCU14f7Ppas4zvs78Q@mail.gmail.com>
Yes, get rid of quotes. But please introduce either one multi-line syntax
or the other (and I prefer just \ at the end of line) and document that
use. I'll soon have to write my own implementation compatible with
--extra-opts and I don't want to have to support 3 different ways either.

On Wed, May 30, 2012 at 1:59 PM, Stephan <[email protected]> wrote:

> Hi!
>
> Holger Weiß asked me to introduce here what I intend to do.
>
> I lately started to use Nagios::Plugin for a plugin I developed at work.
> I came across the --extra-opts parameter and thought that this could be
> very helpful.
>
> Unfortunately I seem to found a bug - or at least - inconsistant behaviour.
>
> When you pass on commandline something like --opt "test value" you get
> in your variable:
>     test value
>
> But if you put into the extra-opts file
>     opt="test value"
> you get
>     "test value"
>
> Okay, I could live with the plugin not removing the quotes, so I put
> into the extra-opts file
>     opt=test vale
> But guess what I got:
>     "test value"
>
> So N::P is introducing quotes here.
>
> So my first idea is to get rid of those quotes.
>
> Unfortunately this will break some of the tests, as they rely on the sub
> _cmdline which generates, from the internal options array, a commandline.
>
> But this sub is, as far as I can see, only used for this test and
> nowhere else.
>
> Additionally the quoting is done wrong or at least for an OS I don't
> know as quotes inside the string are not escaped. So this
>     opt=a 2.5" hard disc
> becomes
>     "a 2.5" hard disc"
>
> So the questions I have are:
> 1) For what reason was the quoting introduced - except for the tests?
> 2) For which platform is it intended? For sure no *IX
> 3) Is it required?
>
> I'd vote for getting rid of the quoting.
>
>
> My second idea is to introduce multiline values in the extra-opts file.
> This would simply be done in the usual way, by putting a backslash "\"
> as last charater of the line. All the lines will be concatenated by a
> single space after first triming them. So
>     opt=multi \
>         line \
>         value
> would become
>     multi line value
>
> Last but not lest I'd like to introduce a HERE-document like syntax in
> conformance to Config::General. Example:
>     opt=<<HERE
>         line 1
>         line 2
>         line 3
>         HERE
> would become
>     line1\nline 2\nline 3\n
>
> and, as the amount of whitespace before the end-marker is removed from
> all the lines:
>     opt=<<HERE
>         line 1
>             line 2
>         line 3
>         HERE
> would become
>     line1\n    line2\nline 3\n
>
> What do you think about my ideas?
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________________
> Nagios Plugin Development Mailing List
> Nagiosplug-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Unsubscribe at
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________________
Nagios Plugin Development Mailing List Nagiosplug-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
::: Please include plugins version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.