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 branch netdot-1.0 updated.
      netdot-1.0.4-34-g64daae1 ([email protected])
   2. [Netdot - Bug #1736] (New) REST updating host     without passing
      name param doesn't work ([email protected])
   3. [Netdot - Bug #1736] REST updating host without   passing name
      param doesn't work ([email protected])


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

Message: 1
Date: Tue, 12 Feb 2013 19:13:26 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.4-34-g64daae1
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".

The branch, netdot-1.0 has been updated
       via  64daae1923f58f2145b90ff5272f5048c43de18d (commit)
      from  2cb03664aec31d3347f152eef3c5bff379d88e5d (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 64daae1923f58f2145b90ff5272f5048c43de18d
Author: Carlos Vicente <[email protected]>
Date:   Wed Feb 13 02:35:57 2013 +0000

    Use whois.radb.net for queries in check_bgppeer.pl

diff --git a/bin/check_bgppeer.pl b/bin/check_bgppeer.pl
index 858859d..58797da 100755
--- a/bin/check_bgppeer.pl
+++ b/bin/check_bgppeer.pl
@@ -2,7 +2,7 @@
 #
 # check_bgppeer.pl - nagios plugin 
 #
-# Copyright (C) 2009 Carlos Vicente
+# Copyright (C) 2013 Carlos Vicente
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -24,7 +24,7 @@
 #
 # 08/05/2009 Version 1.1
 # 09/29/2011 Version 1.2 - Fixed incorrect return values
-#
+# 09/29/2011 Version 1.3 - Use radb.net as whois server
 
 use SNMP;
 use strict;
@@ -32,8 +32,8 @@ use Getopt::Long qw(:config no_ignore_case bundling);
 
 # whois program for Registry database queries
 my $whois      = '/usr/bin/whois';
-my $whoissrv   = 'whois.arin.net';
-my $whoisfield = "ASName";
+my $whoissrv   = 'whois.radb.net';
+my $whoisfield = "as-name";
 my $TIMEOUT    = 30;
 my %self;
 
@@ -62,7 +62,7 @@ my $usage = <<EOF;
   Perl BGP peer check plugin for Nagios
   Monitors BGP session of a particular peer
 
-  Copyright (C) 2009 Carlos Vicente
+  Copyright (C) 2013 Carlos Vicente
   $0 comes with ABSOLUTELY NO WARRANTY
   This programm is licensed under the terms of the
   GNU General Public License\n(check source code for details)

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

Summary of changes:
 bin/check_bgppeer.pl |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Netdot


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

Message: 2
Date: Wed, 13 Feb 2013 01:40:03 -0800
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1736] (New) REST updating host
        without passing name param doesn't work
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1736 has been reported by Matej Vadnjal.

----------------------------------------
Bug #1736: REST updating host without passing name param doesn't work
https://osl.uoregon.edu/redmine/issues/1736

Author: Matej Vadnjal
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 
Resolution: 


When updating host records (/netdot/rest/host) if you don't supply a name 
parameter it is assumed to be undefined. If the user changing the record has 
non admin privileges hostname validation fails. If the user is an admin the 
record is updated and the hostname is set to blank.

The fix is very simple. Patch attached.




-- 
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: Wed, 13 Feb 2013 01:42:04 -0800
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1736] REST updating host
        without passing name param doesn't work
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1736 has been updated by Matej Vadnjal.


The duscussion on the mailing list:

<pre>

    On 11. 02. 2013 20:43, Patrick Landry wrote:
    >>  One thing I did find was that in order to update a host you need to
    >> include the 'name' parameter in the data portion of the POST. Unless
    >> this is a requirement of the Netdot-Client-REST module only, the
    >> manual is incomplete in this regard.
    >Thats odd. It works for me.

I am attempting to update a host (DNS record). It is easy to code it such that 
it works.

CODE:

my $hostname = 'testing3';
my $host;
my $hostrrid;

my $netdot = Netdot::Client::REST->new(
         server   =>'http://cannon.private.my.domain/netdot',
         username => 'pml4791',
         password => 'mca1304cwyl',
    );

print "CREATE HOST\n";
my $data = {};
$data->{'zone'} = 'private.my.domain';
$data->{'info'} = "This is a comment";
$data->{'subnet'} = '10.35.4.0/24';
eval {$netdot->post('host?name='.$hostname, $data);};
if ($@) {
  print "Error creating host: $hostname \$data:\n", Dumper($data), $@;
}
else {
  print "SUCCESS create\n";
}
$host = $netdot->get("host?name=$hostname");
($hostrrid) = keys %{$host->{RR}};
print Dumper($host);


print "UPDATE HOST WITHOUT PROVIDING HOSTNAME\n";
$data = {};
$data->{info} = "This is a new comment";
eval {$netdot->post('host?rrid='.$hostrrid, $data);};
if ($@) {
  print "Error#1 updating host: $hostrrid \$data:\n", Dumper($data), $@;
}
else {
  print "SUCCESS update 1\n";
}
$host = $netdot->get("host?name=$hostname");
($hostrrid) = keys %{$host->{RR}};
print Dumper($host);

print "UPDATE HOST PROVIDING HOSTNAME\n";
$data = {};
$data->{name} = $hostname;
$data->{info} = "This is a new comment";
eval {$netdot->post('host?rrid='.$hostrrid, $data);};
if ($@) {
  print "Error#2 updating host: $hostrrid \$data:\n", Dumper($data), $@;
}
else {
  print "SUCCESS update 2\n";
}

my $host = $netdot->get("host?name=$hostname");
($hostrrid) = keys %{$host->{RR}};
print Dumper($host);


OUTPUT:

CREATE HOST
SUCCESS create
$VAR1 = {
          'RR' => {
                    '1701' => {
                              'info' => 'This is a comment',
                              'auto_update' => '0',
                              'zone' => 'private.my.domain',
                              'name' => 'testing3',
                              'active' => '1',
                              'modified' => '2013-02-12 11:05:00',
                              'created' => '2013-02-12 11:05:00',
                              'expiration' => '',
                              'zone_xlink' => 'Zone/11'
                            }
                  },
          'Ipblock' => {
                       '1285344' => {
                                    'used_by' => '0',
                                    'status' => 'Static',
                                    'use_network_broadcast' => '0',
                                    'status_xlink' => 'IpblockStatus/6',
                                    'last_seen' => '2013-02-04 11:48:25',
                                    'interface' => '0',
                                    'parent_xlink' => 'Ipblock/9526',
                                    'first_seen' => '2013-02-04 11:48:25',
                                    'address' => '10.35.4.12',
                                    'owner' => '0',
                                    'info' => '',
                                    'parent' => '10.35.4.0/24',
                                    'version' => '4',
                                    'vlan' => '0',
                                    'description' => '',
                                    'prefix' => '32'
                                  }
                     }
        };
UPDATE HOST WITHOUT PROVIDING HOSTNAME
Error#1 updating host: 1701 $data:
$VAR1 = {
          'info' => 'This is a new comment'
        };
File does not exist: Bad request: $e at 
/usr/local/share/perl5/Netdot/Client/REST.pm line 203
$VAR1 = {
          'RR' => {
                    '1701' => {
                              'info' => 'This is a comment',
                              'auto_update' => '0',
                              'zone' => 'private.my.domain',
                              'name' => 'testing3',
                              'active' => '1',
                              'modified' => '2013-02-12 11:05:00',
                              'created' => '2013-02-12 11:05:00',
                              'expiration' => '',
                              'zone_xlink' => 'Zone/11'
                            }
                  },
          'Ipblock' => {
                       '1285344' => {
                                    'used_by' => '0',
                                    'status' => 'Static',
                                    'use_network_broadcast' => '0',
                                    'status_xlink' => 'IpblockStatus/6',
                                    'last_seen' => '2013-02-04 11:48:25',
                                    'interface' => '0',
                                    'parent_xlink' => 'Ipblock/9526',
                                    'first_seen' => '2013-02-04 11:48:25',
                                    'address' => '10.35.4.12',
                                    'owner' => '0',
                                    'info' => '',
                                    'parent' => '10.35.4.0/24',
                                    'version' => '4',
                                    'vlan' => '0',
                                    'description' => '',
                                    'prefix' => '32'
                                  }
                     }
        };
UPDATE HOST PROVIDING HOSTNAME
SUCCESS update 2
$VAR1 = {
          'RR' => {
                    '1701' => {
                              'info' => 'This is a new comment',
                              'auto_update' => '0',
                              'zone' => 'private.my.domain',
                              'name' => 'testing3',
                              'active' => '1',
                              'modified' => '2013-02-12 11:05:00',
                              'created' => '2013-02-12 11:05:00',
                              'expiration' => '',
                              'zone_xlink' => 'Zone/11'
                            }
                  },
          'Ipblock' => {
                       '1285344' => {
                                    'used_by' => '0',
                                    'status' => 'Static',
                                    'use_network_broadcast' => '0',
                                    'status_xlink' => 'IpblockStatus/6',
                                    'last_seen' => '2013-02-04 11:48:25',
                                    'interface' => '0',
                                    'parent_xlink' => 'Ipblock/9526',
                                    'first_seen' => '2013-02-04 11:48:25',
                                    'address' => '10.35.4.12',
                                    'owner' => '0',
                                    'info' => '',
                                    'parent' => '10.35.4.0/24',
                                    'version' => '4',
                                    'vlan' => '0',
                                    'description' => '',
                                    'prefix' => '32'
                                  }
                     }
        };
</pre>

----------------------------------------
Bug #1736: REST updating host without passing name param doesn't work
https://osl.uoregon.edu/redmine/issues/1736#change-3037

Author: Matej Vadnjal
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 
Resolution: 


When updating host records (/netdot/rest/host) if you don't supply a name 
parameter it is assumed to be undefined. If the user changing the record has 
non admin privileges hostname validation fails. If the user is an admin the 
record is updated and the hostname is set to blank.

The fix is very simple. Patch attached.




-- 
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 71, Issue 9
*******************************************

Reply via email to