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-RC2-1-g05bfd9c (Apache)
   2. [SCM] Netdot Git repository branch netdot-1.0     updated.
      netdot-1.0.1-RC2-2-g5cb5425 (Apache)


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

Message: 1
Date: Sat, 23 Jun 2012 18:52:56 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
        updated. netdot-1.0.1-RC2-1-g05bfd9c
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  05bfd9c3f4a49a67f00a2638d59b3bd60d8453be (commit)
      from  5b29dd3f57041e2dd80d733f7c824b1520ff6f9d (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 05bfd9c3f4a49a67f00a2638d59b3bd60d8453be
Author: Carlos Vicente <[email protected]>
Date:   Sat Jun 23 21:51:46 2012 -0400

    Ignore values with non-ascii characters when retrieving module info

diff --git a/lib/Netdot.pm b/lib/Netdot.pm
index 9c99021..030b8cf 100644
--- a/lib/Netdot.pm
+++ b/lib/Netdot.pm
@@ -238,6 +238,26 @@ sub rem_lt_sp {
     return $str;
 }
 
+######################################################################
+=head2 is_ascii - Determine if value is ascii only
+
+    If value has non-ascii characters, returns 0
+       
+   Arguments: 
+    string
+   Returns:
+    1 or 0
+   Example:
+    if $self->is_ascii($str);
+=cut   
+sub is_ascii {
+    my ($self, $v) = @_;
+    return unless $v;
+    return 0 if ( $v =~ /[^[:ascii:]]/o );
+    return 1;
+}
+
+
 ############################################################################
 # cache - Get or set memory data cache
 #
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index c944bed..5d578f6 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -918,7 +918,7 @@ sub get_snmp_info {
                next if !exists $dp_hashes{$m}->{$key};
                my $v = $dp_hashes{$m}->{$key};
                # Ignore values with non-ascii chars
-               next if ( $v =~ /[^[:ascii:]]/o );
+               next unless $self->is_ascii($v);
 
                # SNMP::Info can include values from both LLDP and CDP
                # which means that for each port, we can have different

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

Summary of changes:
 lib/Netdot.pm              |   20 ++++++++++++++++++++
 lib/Netdot/Model/Device.pm |    2 +-
 2 files changed, 21 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Netdot Git repository


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

Message: 2
Date: Sat, 23 Jun 2012 18:58:43 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
        updated. netdot-1.0.1-RC2-2-g5cb5425
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  5cb54250e0508a7d4d0c04e970087c140f6233f6 (commit)
      from  05bfd9c3f4a49a67f00a2638d59b3bd60d8453be (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 5cb54250e0508a7d4d0c04e970087c140f6233f6
Author: Carlos Vicente <[email protected]>
Date:   Sat Jun 23 21:55:38 2012 -0400

    Ignore values with non-ascii characters when retrieving module info

diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 5d578f6..b18b9b1 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -947,12 +947,13 @@ sub get_snmp_info {
            $dev{module}{$key}{number} = $key;;
            foreach my $field ( keys %MFIELDS ){
                my $method = $MFIELDS{$field};
-               if ( defined($hashes{$method}->{$key}) && 
$hashes{$method}->{$key} =~ /\w+/ ){
+               my $v = $hashes{$method}->{$key};
+               if ( defined($v) && $self->is_ascii($v) ){
                    if ( $field eq 'fru' ){
                        # This is boolean
-                       $dev{module}{$key}{$field} = ( $hashes{$method}->{$key} 
eq 'true' )? 1 : 0;
+                       $dev{module}{$key}{$field} = ( $v eq 'true' )? 1 : 0;
                    }else{
-                       $dev{module}{$key}{$field} = $hashes{$method}->{$key};
+                       $dev{module}{$key}{$field} = $v;
                    }
                }
            }

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

Summary of changes:
 lib/Netdot/Model/Device.pm |    7 ++++---
 1 files changed, 4 insertions(+), 3 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 63, Issue 34
********************************************

Reply via email to