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. [SCM] Netdot Git repository branch netdot-1.0     updated.
      netdot-1.0.1-RC3-22-ga4ed7c2 (Apache)
   2. [Netdot - Bug #1662] Support for staging dir
      ([email protected])
   3. [Netdot - Bug #1663] (New) Device Discovery Invalid
      Underscores ([email protected])
   4. [Netdot - Bug #1663] Device Discovery Invalid     Underscores
      ([email protected])
   5. [SCM] Netdot Git repository branch netdot-1.0     updated.
      netdot-1.0.1-RC3-23-g3cc9bf5 (Apache)
   6. [SCM] Netdot Git repository branch netdot-1.0     updated.
      netdot-1.0.1-RC3-24-gf11f8dc (Apache)


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

Message: 1
Date: Fri, 20 Jul 2012 13:37:27 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
        updated. netdot-1.0.1-RC3-22-ga4ed7c2
To: [email protected]
Message-ID: <[email protected]>

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot Git repository".

The branch, netdot-1.0 has been updated
       via  a4ed7c216b1bf5a07bf22708a04c6c189d613590 (commit)
       via  9f5fa4df247fc18f56a17dc071061f0b7089d9b9 (commit)
       via  6636952a00affaaca48ea566d64e6e38481c5792 (commit)
      from  095e62f86d4faa156032d64ab231d1840fc3ab39 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a4ed7c216b1bf5a07bf22708a04c6c189d613590
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 20 16:36:46 2012 -0400

    Correction

diff --git a/lib/Netdot/Model/Interface.pm b/lib/Netdot/Model/Interface.pm
index 0e53e73..822e9cb 100644
--- a/lib/Netdot/Model/Interface.pm
+++ b/lib/Netdot/Model/Interface.pm
@@ -578,7 +578,12 @@ sub update_ip {
        $logger->debug(sprintf("%s: Adding or updating subnet %s/%d", 
                               $label, $subnetaddr, $subnetprefix));
        
-       if ( ($version == 4 && $subnetprefix == 31) || $subnetaddr ne $address 
){
+       # Make sure we compare the same formatting
+       my $subnet_netaddr = Ipblock->netaddr(address=>$subnetaddr, 
prefix=>$subnetprefix);
+       my $address_netaddr = Ipblock->netaddr(address=>$address);
+
+       if ( $subnet_netaddr->addr ne $address_netaddr->addr || 
+            ($version == 4 && $subnetprefix == 31) ){
            my %iargs;
            $iargs{status} = 'Subnet' ;
            
@@ -600,8 +605,8 @@ sub update_ip {
                $logger->debug(sub{ sprintf("Subnet %s/%s does not exist.  
Inserting.", 
                                            $subnetaddr, $subnetprefix) });
                
-               $iargs{address} = $subnetaddr;
-               $iargs{prefix}  = $subnetprefix;
+               $iargs{address} = $subnet_netaddr->addr;
+               $iargs{prefix}  = $subnet_netaddr->masklen;
                $iargs{version} = $version;
                
                # Check if subnet should inherit device info
@@ -617,7 +622,7 @@ sub update_ip {
                };
                if ( my $e = $@ ){
                    $logger->error(sprintf("%s: Could not insert Subnet %s/%s: 
%s", 
-                                          $label, $subnetaddr, $subnetprefix, 
$e));
+                                          $label, $subnet_netaddr->addr, 
$subnet_netaddr->masklen, $e));
                }else{
                    $logger->info(sprintf("%s: Created Subnet %s/%s", 
                                          $label, $subnetaddr, $subnetprefix));
diff --git a/lib/Netdot/Model/Ipblock.pm b/lib/Netdot/Model/Ipblock.pm
index e5ba009..4d452db 100644
--- a/lib/Netdot/Model/Ipblock.pm
+++ b/lib/Netdot/Model/Ipblock.pm
@@ -579,13 +579,15 @@ sub within{
 sub insert {
     my ($class, $argv) = @_;
     $class->isa_class_method('insert');
-    
+
     $class->throw_fatal("Missing required arguments: address")
        unless ( exists $argv->{address} );
 
-    if ( $argv->{address} =~ /.+\/\d+$/ ){
+    if ( $argv->{address} =~ /.+\/\d+$/o ){
        # Address is in CIDR format
-       ($argv->{address}, $argv->{prefix}) = split /\//, $argv->{address};
+       my ($a,$p) = split /\//, $argv->{address};
+       $argv->{address} = $a;
+       $argv->{prefix} ||= $p; # Only if not passed explicitly
     }
 
     unless ( $argv->{status} ){
@@ -599,8 +601,7 @@ sub insert {
     }
     
     # $ip is a NetAddr::IP object;
-    my $ip;
-    $ip = $class->_prevalidate($argv->{address}, $argv->{prefix});
+    my $ip = $class->_prevalidate($argv->{address}, $argv->{prefix});
     $argv->{address} = $ip->addr;
     $argv->{prefix}  = $ip->masklen;
     $argv->{version} = $ip->version;
@@ -693,7 +694,18 @@ sub insert {
        if ( $num && $num < $newblock->num_addr ){
            for ( 1..$num ){
                my $addr = $newblock->get_next_free();
-               $class->insert({address=>$addr, status=>'Reserved'});
+               eval {
+                   $class->insert({address=>$addr, status=>'Reserved', 
validate=>0});
+               };
+               if ( my $e = $@ ){
+                   if ( $e =~ /Duplicate/io ){
+                       # This happens often when running parallel processes
+                       # Just go on
+                   }else{
+                       $logger->warn("Ipblock::insert: Failed to insert one of 
first ".
+                                     "N addresses in subnet: $e");
+                   }
+               }
            }
        }
     }
@@ -2778,7 +2790,6 @@ sub netaddr {
 
 sub _prevalidate {
     my ($class, $address, $prefix) = @_;
-
     $class->isa_class_method('_prevalidate');
 
     $class->throw_fatal("Ipblock::_prevalidate: Missing required arguments: 
address")
@@ -2792,9 +2803,9 @@ sub _prevalidate {
        $class->throw_user("The unspecified IP: $address is not valid");
     }
 
-    my $ip;
+    my $ip = NetAddr::IP->new($address, $prefix);
     my $str = ( $address && $prefix ) ? (join('/', $address, $prefix)) : 
$address;
-    if ( !($ip = NetAddr::IP->new($address, $prefix)) || $ip->numeric == 0 ){
+    if ( !$ip || $ip->numeric == 0 ){
        $class->throw_user("Invalid IP: $str");
     }
 

commit 9f5fa4df247fc18f56a17dc071061f0b7089d9b9
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 20 16:35:30 2012 -0400

    Correction

diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index cecf4ee..28c5938 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -2805,6 +2805,8 @@ sub info_update {
        $dev_product = $self->_assign_product($info);
        $asset_args{product_id} = $dev_product->id;
        $asset = Asset->insert(\%asset_args);
+    }else{
+       $dev_product = $self->_assign_product($info);   
     }
     $devtmp{asset_id} = $asset->id if $asset;
     

commit 6636952a00affaaca48ea566d64e6e38481c5792
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 20 14:34:01 2012 -0400

    Correction in SQL query

diff --git a/lib/Netdot/Model/ArpCacheEntry.pm 
b/lib/Netdot/Model/ArpCacheEntry.pm
index c7fac50..6c637f3 100644
--- a/lib/Netdot/Model/ArpCacheEntry.pm
+++ b/lib/Netdot/Model/ArpCacheEntry.pm
@@ -3,6 +3,7 @@ package Netdot::Model::ArpCacheEntry;
 use base 'Netdot::Model';
 use warnings;
 use strict;
+use DBI qw(:sql_types);
 
 my $logger = Netdot->log->get_logger('Netdot::Model::Device');
 
@@ -56,14 +57,16 @@ sub fast_insert{
     # Now walk our list and insert
     foreach my $r ( @$list ){
        my $plen = ($r->{version} == 6)? 128 : 32;
+       $sth->bind_param(1, $r->{arpcache});
+       $sth->bind_param(2, $r->{interface});
+       # Workaround for http://bugs.mysql.com/bug.php?id=60213
+       # See another example in Ipblock::search()
+       $sth->bind_param(3, "".$r->{ipaddr}, SQL_INTEGER);
+       $sth->bind_param(4, $plen);
+       $sth->bind_param(5, $r->{version});
+       $sth->bind_param(6, $r->{physaddr});
        eval {
-           $sth->execute($r->{arpcache}, 
-                         $r->{interface},
-                         $r->{ipaddr},
-                         $plen,
-                         $r->{version},
-                         $r->{physaddr},
-               );
+           $sth->execute();
        };
        if ( my $e = $@ ){
            $logger->warn("Problem inserting arpcacheentry: $e");

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

Summary of changes:
 lib/Netdot/Model/ArpCacheEntry.pm |   17 ++++++++++-------
 lib/Netdot/Model/Device.pm        |    2 ++
 lib/Netdot/Model/Interface.pm     |   13 +++++++++----
 lib/Netdot/Model/Ipblock.pm       |   29 ++++++++++++++++++++---------
 4 files changed, 41 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
Netdot Git repository


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

Message: 2
Date: Fri, 20 Jul 2012 14:28:45 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1662] Support for staging dir
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1662 has been updated by Francesco Colista.


Hi. First of all, thanks for the answer.
I don't mention the version, you're right.
I'm referring to the last one: 1.0.1-RC3.
Thanks.
----------------------------------------
Bug #1662: Support for staging dir
https://osl.uoregon.edu/redmine/issues/1662

Author: Francesco Colista
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 
Resolution: 


Hi. I'm trying to compile netdot for Alpine Linux (www.alpinelinux.org).

Netdot actually does not support staging dir, so when the package is created 
the substitution of PREFIX uses the full path.
This cause an extensive patching in order to remove the unneeded path.

Would be possible to include the possibility to install netdot in a temp dir, 
in the upstream?

This is a patch for Makefile:

---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<

--- ./Makefile.orig
+++ ./Makefile
@@ -91,14 +91,14 @@
        @echo "Creating necessary directories..."
        echo $(PREFIX) > ./.prefix
        for dir in $(DIR); do \
-           if test -d $(PREFIX)/$$dir; then \
-              echo "Skipping dir $(PREFIX)/$$dir; already exists"; \
+           if test -d $(DESTDIR)$(PREFIX)/$$dir; then \
+              echo "Skipping dir $(DESTDIR)$(PREFIX)/$$dir; already exists"; \
            else \
-              mkdir -m $(DMOD) -p $(PREFIX)/$$dir ; \
+              mkdir -m $(DMOD) -p $(DESTDIR)$(PREFIX)/$$dir ; \
            fi ; \
        done
-       chown -R $(APACHEUSER):$(APACHEGROUP) $(PREFIX)/tmp
-       chmod 750 $(PREFIX)/tmp
+       chown -R $(APACHEUSER):$(APACHEGROUP) $(DESTDIR)$(PREFIX)/tmp
+       chmod 750 $(DESTDIR)$(PREFIX)/tmp
 
 htdocs:
        cd $@ ; $(MAKE) all DIR=$@ 


---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<


Thanks.




-- 
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: Fri, 20 Jul 2012 15:39:30 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1663] (New) Device Discovery
        Invalid Underscores
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1663 has been reported by Mike Heeb.

----------------------------------------
Bug #1663: Device Discovery Invalid Underscores
https://osl.uoregon.edu/redmine/issues/1663

Author: Mike Heeb
Status: New
Priority: Normal
Assignee: 
Category: DeviceManagement
Target version: 1.0.1-RC3
Resolution: 


When adding a device, if the device name contains an underscore an error is 
returned.

+Ex:+
Device name: serverroom_3750e


+Error returned:+
updatedevice.html produced the following error:
Invalid name: serverroom_3750e. Invalid underscores




-- 
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: 4
Date: Fri, 20 Jul 2012 18:24:55 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1663] Device Discovery Invalid
        Underscores
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1663 has been updated by Carlos Vicente.


Hi Mike,

Underscores are not valid characters in a DNS hostname.
----------------------------------------
Bug #1663: Device Discovery Invalid Underscores
https://osl.uoregon.edu/redmine/issues/1663

Author: Mike Heeb
Status: New
Priority: Normal
Assignee: 
Category: DeviceManagement
Target version: 1.0.1-RC3
Resolution: 


When adding a device, if the device name contains an underscore an error is 
returned.

+Ex:+
Device name: serverroom_3750e


+Error returned:+
updatedevice.html produced the following error:
Invalid name: serverroom_3750e. Invalid underscores




-- 
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: 5
Date: Fri, 20 Jul 2012 19:40:34 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
        updated. netdot-1.0.1-RC3-23-g3cc9bf5
To: [email protected]
Message-ID: <[email protected]>

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot Git repository".

The branch, netdot-1.0 has been updated
       via  3cc9bf52e839543ffd178618acf45be37102fa6e (commit)
      from  a4ed7c216b1bf5a07bf22708a04c6c189d613590 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3cc9bf52e839543ffd178618acf45be37102fa6e
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 20 22:40:04 2012 -0400

    Check for value length was too low level. Moved to UI code

diff --git a/htdocs/generic/edit.html b/htdocs/generic/edit.html
index 5e2828f..cd141ac 100644
--- a/htdocs/generic/edit.html
+++ b/htdocs/generic/edit.html
@@ -140,6 +140,7 @@ if ( $table ){
                    if ( $state_digest && ($state_digest ne $new_digest) ){
                        $ui->throw_user('This object changed while you were 
editing!');
                    }
+                   $ui->check_value_lenghts($table, \%args);
                    $obj->update(\%args);
                                               });
            };
@@ -158,7 +159,10 @@ if ( $table ){
            $ui->localize_newlines($table, \%args);
            my $new;
            eval{
-               $new = $table->insert(\%args);
+               Netdot::Model->do_transaction( sub{
+                   $ui->check_value_lenghts($table, \%args);
+                   $new = $table->insert(\%args);
+                                              });
            };
            if ( my $e = $@ ){
                $m->comp('error.mhtml', error=>$e);
diff --git a/lib/Netdot/Model.pm b/lib/Netdot/Model.pm
index 0c89359..c411935 100644
--- a/lib/Netdot/Model.pm
+++ b/lib/Netdot/Model.pm
@@ -1187,22 +1187,9 @@ sub _adjust_vals{
     map { $meta_columns{$_->name} = $_ } $class->meta_data->get_columns;
     foreach my $field ( keys %$args ){
        my $mcol = $meta_columns{$field} || $class->throw_fatal("Cannot find 
$field in $class metadata");
-       if ( !blessed($args->{$field}) && $mcol->sql_type eq 'varchar' 
-            && defined($mcol->length) && $mcol->length =~ /^\d+$/ ) {
-            if (defined($args->{$field}) && length($args->{$field}) > 
$mcol->length) {
-               my $msg = "Value for field '$field' (max " . $mcol->length . 
-                   ") is too long: '$args->{$field}'";
-               if ( $ENV{REMOTE_USER} eq 'netdot' ){
-                   $logger->debug($msg);
-               }else{
-                   $class->throw_user($msg);
-               }
-            }
-        }
        if ( !blessed($args->{$field}) && 
             (!defined($args->{$field}) || $args->{$field} eq '' || 
              $args->{$field} eq 'null' || $args->{$field} eq 'NULL' ) ){
-
            if ( $mcol->links_to ){
                # It's a foreign key. Set to null
                $args->{$field} = undef;
diff --git a/lib/Netdot/UI.pm b/lib/Netdot/UI.pm
index d19ccb7..3a1c1da 100644
--- a/lib/Netdot/UI.pm
+++ b/lib/Netdot/UI.pm
@@ -224,6 +224,7 @@ sub form_to_db{
                my $newid;
                my $args = \%{ $objs{$table}{$id} };
                $self->localize_newlines($table, $args);
+               $self->check_value_lengths($table, $args);
                $newid = $table->insert($args);
                $ret{$table}{id}{$newid}{action} = "INSERTED";
                $act = 1;
@@ -250,6 +251,7 @@ sub form_to_db{
                    if ( my $o = $table->retrieve($id) ){
                        my $args = \%{ $objs{$table}{$id} };
                        $self->localize_newlines($table, $args);
+                       $self->check_value_lengths($table, $args);
                        $o->update($args);
                        $ret{$table}{id}{$id}{action}  = "UPDATED";
                        $ret{$table}{id}{$id}{columns} = $args;
@@ -2448,6 +2450,34 @@ sub localize_newlines {
     1;
 }
 
+############################################################################
+=head check_value_lengths
+
+  Arguments: table, args hashref
+  Returns: True
+  Examples: $ui->_check_value_lenghts(\%args);
+
+=cut
+sub check_value_lenghts {
+    my($self, $table, $args) = @_;
+    foreach my $c ( keys %$args ){
+       my $mcol;
+       eval {
+           $mcol = $table->meta_data->get_column($c);
+       };
+       next if ( $@ =~ /does not exist/ );
+       my $val = $args->{$c};
+       next unless defined $val;
+       my $type = $mcol->sql_type || next;
+       if ( $type eq 'varchar' && defined($mcol->length) 
+            && ($mcol->length =~ /^\d+$/o) && (length($val) > $mcol->length) ){
+           $self->throw_user("Value for field '$c' (max " . $mcol->length . 
+                             ") is too long: '$val'");
+       }
+    }
+    1;
+}
+
 
 =head1 AUTHORS
 

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

Summary of changes:
 htdocs/generic/edit.html |    6 +++++-
 lib/Netdot/Model.pm      |   13 -------------
 lib/Netdot/UI.pm         |   30 ++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
Netdot Git repository


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

Message: 6
Date: Fri, 20 Jul 2012 20:30:54 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
        updated. netdot-1.0.1-RC3-24-gf11f8dc
To: [email protected]
Message-ID: <[email protected]>

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot Git repository".

The branch, netdot-1.0 has been updated
       via  f11f8dc0ab44b01f324e8bcf017983689d4012b5 (commit)
      from  3cc9bf52e839543ffd178618acf45be37102fa6e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f11f8dc0ab44b01f324e8bcf017983689d4012b5
Author: Carlos Vicente <[email protected]>
Date:   Fri Jul 20 23:30:23 2012 -0400

    Avoid Perl warnings in Rancid export

diff --git a/lib/Netdot/Exporter/Rancid.pm b/lib/Netdot/Exporter/Rancid.pm
index c402df9..5e602a8 100644
--- a/lib/Netdot/Exporter/Rancid.pm
+++ b/lib/Netdot/Exporter/Rancid.pm
@@ -71,14 +71,14 @@ sub generate_configs {
     my ($self) = @_;
 
     my $query = $self->{_dbh}->selectall_arrayref("
-                SELECT     rr.name, zone.name, p.name, p.sysobjectid, 
p.config_type, e.name, e.config_type,
-                           d.sysdescription, d.monitor_config, 
d.monitor_config_group, d.down_from, d.down_until
-                 FROM      device d, rr, zone, product p, entity e, asset a
-                WHERE      d.name=rr.id
-                  AND      rr.zone=zone.id
-                  AND      a.product_id=p.id
-                  AND      d.asset_id=a.id
-                  AND      p.manufacturer=e.id
+          SELECT rr.name, zone.name, p.name, p.sysobjectid, p.config_type, 
e.name, e.config_type,
+                 d.sysdescription, d.monitor_config, d.monitor_config_group, 
d.down_from, d.down_until
+          FROM   device d, rr, zone, product p, entity e, asset a
+          WHERE  d.name=rr.id
+          AND    rr.zone=zone.id
+          AND    a.product_id=p.id
+          AND    d.asset_id=a.id
+          AND    p.manufacturer=e.id
          ");
     
     my %groups;
@@ -89,7 +89,8 @@ sub generate_configs {
        my $name = $rrname . "." . $zone;
 
        unless ( $monitor ){
-           $logger->debug("Netdot::Exporter::Rancid::generate_configs: $name 
configured to not monitor config");
+           $logger->debug("Netdot::Exporter::Rancid::generate_configs: $name 
configured ".
+                          "to not monitor config");
            next;
        }
 
@@ -98,9 +99,10 @@ sub generate_configs {
            next;
        }
 
-       if ( exists $self->{EXCLUDE}->{$oid} ){
+       if ( defined $oid && exists $self->{EXCLUDE}->{$oid} ){
            my $descr = $self->{EXCLUDE}->{$oid};
-           $logger->debug("Netdot::Exporter::Rancid::generate_configs: $name: 
$descr ($oid) excluded per configuration");
+           $logger->debug("Netdot::Exporter::Rancid::generate_configs: $name: 
$descr ($oid) ".
+                          "excluded per configuration");
            next;
        }
        
@@ -112,7 +114,8 @@ sub generate_configs {
            my $time2 = Netdot::Model->sqldate2time($down_until);
            my $now = time;
            if ( $time1 < $now && $now < $time2 ){
-               $logger->debug("Netdot::Exporter::Rancid::generate_configs: 
$name in down time. Setting state to 'down'.");
+               $logger->debug("Netdot::Exporter::Rancid::generate_configs: 
$name in down time. ".
+                              "Setting state to 'down'.");
                $groups{$group}{$name}{state} = 'down';
            }
        }
@@ -123,7 +126,8 @@ sub generate_configs {
                                      sysdescr => $sysdescr,
            );
        unless ( $mfg ) {
-           $logger->debug("Netdot::Exporter::Rancid::generate_configs: $name: 
$vendor has no RANCID device_type mapping");
+           $logger->debug("Netdot::Exporter::Rancid::generate_configs: $name: 
$vendor has no ".
+                          "RANCID device_type mapping");
            next;
        }
        $groups{$group}{$name}{mfg} = $mfg;
@@ -133,14 +137,15 @@ sub generate_configs {
        my $dir_path  = $self->{RANCID_DIR}."/".$group;
        unless ( -d $dir_path ){
            system("mkdir -p $dir_path") 
-               && 
$self->throw_fatal("Netdot::Exporter::Rancid::generate_configs: Can't make dir 
$dir_path: $!");
+               && 
$self->throw_fatal("Netdot::Exporter::Rancid::generate_configs: Cannot make dir 
".
+                                     "$dir_path: $!");
        }
        my $file_path = "$dir_path/".$self->{RANCID_FILE};
        my $rancid = $self->open_and_lock($file_path);
 
        foreach my $device ( sort keys %{$groups{$group}} ){
-           my $mfg   = $groups{$group}{$device}{mfg};
-           my $state = $groups{$group}{$device}{state};
+           my $mfg   = $groups{$group}{$device}{mfg} || next;
+           my $state = $groups{$group}{$device}{state} || next;
            print $rancid $device, ":$mfg:$state\n";
        }
        close($rancid) || 
$logger->warn("Netdot::Exporter::Rancid::generate_configs: ".

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

Summary of changes:
 lib/Netdot/Exporter/Rancid.pm |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
Netdot Git repository


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

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


End of Netdot-devel Digest, Vol 64, Issue 19
********************************************

Reply via email to