PacketFence - BTS - PacketFence
View Issue Details
0001352PacketFenceconfigurationpublic2011-12-27 09:272012-02-28 14:31
fgaudreault 
obilodeau 
highminoralways
closedfixed 
devel 
3.2.03.2.0 
a074717c2d137b2d447d818975f852b0e1730caa
0001352: Misleading error message if missing management type
Instead of saying that there is a typo or that the management type is missing from pf.conf, we have this misleading error message :

Can't call method "tag" on an undefined value at

        /usr/local/pf/lib/pf/pfcmd/checkup.pm line 169 (0000001)

    (F) You used the syntax of a method call, but the slot filled by the

    object reference or package name contains an undefined value. Something

    like this will reproduce the error:

 

        $BADREF = undef;

        process $BADREF 1,2,3;

        $BADREF->process(1,2,3);

 

Uncaught exception from user code:

        Can't call method "tag" on an undefined value at /usr/local/pf/lib/pf/pfcmd/checkup.pm line 169.

at /usr/local/pf/lib/pf/pfcmd/checkup.pm line 169

        pf::pfcmd::checkup::interfaces() called at /usr/local/pf/lib/pf/pfcmd/checkup.pm line 87

        pf::pfcmd::checkup::sanity_check('httpd', 'snmptrapd', 'pfsetvlan', 'pfdhcplistener', 'pfmon') called at /usr/local/pf/bin/pfcmd line 1357

        main::checkup('httpd', 'snmptrapd', 'pfsetvlan', 'pfdhcplistener', 'pfmon') called at /usr/local/pf/bin/pfcmd line 1280

        main::service() called at /usr/local/pf/bin/pfcmd line 201

        main::__ANON__() called at /usr/local/pf/bin/pfcmd line 218
To Fix :

- Ensure that you have an interface in pf.conf with type=management
No tags attached.
Issue History
2011-12-27 09:27fgaudreaultNew Issue
2011-12-30 11:55obilodeauNote Added: 0002494
2012-01-31 15:03obilodeaumtn revision => a074717c2d137b2d447d818975f852b0e1730caa
2012-01-31 15:03obilodeauNote Added: 0002563
2012-01-31 15:03obilodeauStatusnew => resolved
2012-01-31 15:03obilodeauFixed in Version => trunk
2012-01-31 15:03obilodeauResolutionopen => fixed
2012-01-31 15:03obilodeauAssigned To => obilodeau
2012-02-28 14:22obilodeauTarget Version => 3.2.0
2012-02-28 14:22obilodeauFixed in Versiontrunk => 3.2.0
2012-02-28 14:31obilodeauNote Added: 0002592
2012-02-28 14:31obilodeauStatusresolved => closed

Notes
(0002494)
obilodeau   
2011-12-30 11:55   
Easy to fix: wrap in try {} catch {}; or do an explicit ref($...) eq 'objectType' and add warning or fatal.
(0002563)
obilodeau   
2012-01-31 15:03   
was already fixed in rev dd48c0b1f6074b4079419f8f56496c515a238e93 but the fix was quite primitive and only focused on the mgmt interface not defined use-case and not every caller who requires a Net::Netmask object.

This new fix wraps the entire config processing in a try {} catch {} and so should catch other types of mis-use. Also, everything requiring a Net::Netmask object also got a new check and exception thrown.
(0002592)
obilodeau   
2012-02-28 14:31   
Fixed in recently released 3.2.0.