Send Netdot-devel mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://osl.uoregon.edu/mailman/listinfo/netdot-devel
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-devel digest..."


Today's Topics:

   1. [Netdot - Bug #1673] (New) Problem with permissions       on more
      specific Ipblocks ([email protected])
   2. [Netdot - Bug #1674] (New) Netdot 1.0.1 fails to  insert
      overlong sysdescription into PostgreSQL ([email protected])
   3. [Netdot - Bug #1675] (New) Netdot 1.0.1 with      localized
      PostgreSQL ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Mon, 13 Aug 2012 12:02:53 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1673] (New) Problem with
        permissions     on more specific Ipblocks
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1673 has been reported by Carlos Vicente.

----------------------------------------
Bug #1673: Problem with permissions on more specific Ipblocks
https://osl.uoregon.edu/redmine/issues/1673

Author: Carlos Vicente
Status: New
Priority: High
Assignee: 
Category: IPManagement
Target version: 1.0.2
Resolution: 


A user gets assigned permissions to edit 192.168.0.0/16, but also to 
'choose_ip' on 192.168.64.0/24. In this case, Netdot fails to traverse the 
hierarchy upward to detect that it can edit the more specific block.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://osl.uoregon.edu/redmine/my/account


------------------------------

Message: 2
Date: Tue, 14 Aug 2012 03:13:30 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1674] (New) Netdot 1.0.1 fails
        to      insert overlong sysdescription into PostgreSQL
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1674 has been reported by Petr ?ech.

----------------------------------------
Bug #1674: Netdot 1.0.1 fails to insert overlong sysdescription into PostgreSQL
https://osl.uoregon.edu/redmine/issues/1674

Author: Petr ?ech
Status: New
Priority: Normal
Assignee: 
Category: DeviceManagement
Target version: 1.0.1
Resolution: 


Hi,
I've been happy netdot user for some time now. As I like Postgresql more than 
mysql I installed the new version with it. When discovering Cisco Aironet 1130 
I get the following error:

INFO - hsan73.ooegkk.at: SNMP target address set to XXX.XXX.XXX.60
ERROR: Error while updating Device: Can't update 24: DBD::Pg::st execute 
failed: FEHLER:  Wert zu lang f?r Typ character varying(255) [for Statement 
"UPDATE device
SET    sysdescription = ?, last_updated = ?, stp_type = ?, os = ?, snmp_target 
= ?, sysname = ?, asset_id = ?, syslocation = ?, layers = ?
WHERE  id=?
" with ParamValues: 1='Cisco Aironet 1130 Series (IEEE 802.11a/g) Access Point  
Cisco IOS Software, C1130 Software (C1130-K9W7-M), Version 12.4(25d)JA1, 
RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2011 by Cisco Systems, Inc.
Compiled Thu 11-Aug-11 02:44 by prod_rel_team', 2='2012/08/14 11:32:34', 
3=undef, 4='12.4(25d)JA1', 5='113', 6='HSAN73.XXX.XX', 7='144', 8=undef, 
9='00000010', 10='24'] at /usr/share/perl5/DBIx/ContextualFetch.pm line 52.
 at ./updatedevices.pl line 188

Device 24 destroyed without saving changes to sysdescription, last_updated, 
stp_type, os, snmp_target, sysname, asset_id, syslocation, layers at 
./updatedevices.pl line 0


The PostgreSQL error message is in German and it reads "Value to long for type 
varchar(255)". I've solved/worked around with the following change

--- Netdot/Model/Device.pm.orig 2012-08-09 18:57:23.000000000 +0200
+++ Netdot/Model/Device.pm      2012-08-14 11:48:17.256739344 +0200
@@ -740,7 +740,7 @@
     $dev{physaddr}       = $sinfo->b_mac() || $sinfo->mac();
     $dev{sysname}        = $sinfo->name();
     $dev{router_id}      = $sinfo->root_ip();
-    $dev{sysdescription} = $sinfo->description();
+    $dev{sysdescription} = substr $sinfo->description(), 0, 255;
     $dev{syscontact}     = $sinfo->contact();
     if ( $hashes{'e_descr'} ){
        my $first_idx ;


The same should probably be made to the other fields.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://osl.uoregon.edu/redmine/my/account


------------------------------

Message: 3
Date: Tue, 14 Aug 2012 05:19:17 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1675] (New) Netdot 1.0.1 with
        localized PostgreSQL
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1675 has been reported by Petr ?ech.

----------------------------------------
Bug #1675: Netdot 1.0.1 with localized PostgreSQL
https://osl.uoregon.edu/redmine/issues/1675

Author: Petr ?ech
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 1.0.1
Resolution: 


Hi,
I'm running PostgreSQL under German locale and so the error messages get 
translated. The problem is, what in Netdot/Model/Ipblock.pm and 
Netdot/Model/PhysAddr.pm is a test for "Duplicate", which breaks because the 
error in German reads "FEHLER:  doppelter Schl?sselwert verletzt 
Unique-Constraint physaddr1".

It should be noted, that PostgreSQL must be run under English locale 
(lc_messages=C in postgresql.conf) or the user has to fix these two places with 
localized version of the error message.

For PostgreSQL 9.1+ there exists another solution, so called upsert:
--- PhysAddr.pm.orig    2012-07-13 20:17:17.000000000 +0200
+++ PhysAddr.pm 2012-08-14 14:12:59.780489548 +0200
@@ -178,6 +178,16 @@
        foreach my $address ( keys %$macs ){
            $sth->execute($address, $timestamp, $timestamp);
        }
+    } elsif ( $class->config->get('DB_TYPE') eq 'Pg' ) {
+       $logger->debug(sub{ "PhysAddr::fast_update: Pg MAC Update"} );
+       my $sth = $dbh->prepare_cached("WITH upsert AS
+                                       (UPDATE physaddr set last_seen=? WHERE 
address=? returning id)
+                                       INSERT INTO physaddr 
(address,first_seen,last_seen,static)
+                                               SELECT ?, ?, ?, False  WHERE 
NOT EXISTS (SELECT 1 FROM upsert);");
+
+       foreach my $address ( keys %$macs ){
+           $sth->execute($timestamp, $address, $address, $timestamp, 
$timestamp);
+       }
     }else{




-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://osl.uoregon.edu/redmine/my/account


------------------------------

_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel


End of Netdot-devel Digest, Vol 65, Issue 14
********************************************

Reply via email to