Re: testing provider

Jason Long <jason-Dy99Nv/[email protected]> Mon, 07 Mar 2005 07:13:10 -0500
Newsgroups gmane.comp.sysutils.cfg.devel
Message-ID <[email protected]>
Enric Jaen wrote:

>Hi Jason,
>
>I am testing 0.29, and I get this error when I invoke an operation:
>
>Use of uninitialized value in hash element at /usr/local/lib/openwbem/perlproviders/CFG_Nagios.pl line 52.
>Use of uninitialized value in hash element at /usr/local/lib/openwbem/perlproviders/CFG_Nagios.pl line 55.
>Use of uninitialized value in hash element at /usr/local/lib/openwbem/perlproviders/CFG_Nagios.pl line 57.
>Use of uninitialized value in hash element at /usr/local/lib/openwbem/perlproviders/CFG_Nagios.pl line 59.
>
>
>I am not an expert in Perl, but the problem I see in that code is that configfile in  getNagios in initialized with a null argument, as getNagios is called without arguments:
>  
>

>I don't know how to get the configfile in those calls where there is not argument. How can this be solved?
>  
>

getNagios() should always be called with a path to the nagios.cfg config 
file. Cases where you see it without an argument are old code and can be 
considered bugs.

I see the places that this happens are in enumInstances handlers. Since 
no Nagios instance is specified, you'll need to iterate through all 
possible Nagios instances... something like

foreach my $configfile (grep(-f $_, @CONFIG_FILES))
{
    my $nagios = main::getNagios($configfile);

    # enum instances for this Nagios
    # ...
}


>pd ii. I have CC the mail to the mailing list to refresh the project activity.
>  
>

That's good... it's been ages since I've sent out a status update or 
posted a news item... perhaps this will motivate me to do that...

Jason



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click