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 - Feature #1756] Migration to Pg ([email protected])
   2. [SCM] Netdot branch netdot-1.0 updated.
      netdot-1.0.5-rc1-15-g17970ca ([email protected])
   3. [SCM] Netdot branch master updated.
      netdot-1.0.5-rc1-15-g17970ca ([email protected])


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

Message: 1
Date: Tue, 1 Apr 2014 03:26:24 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Feature #1756] Migration to Pg
To: [email protected], [email protected],
        [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1756 has been updated by Nick Hilliard.


i understand the attraction of using postgresql's inet/cidr/macaddr data types, 
but from a user perspective this is a major regression.

most people already have dependencies on mysql for other packages, so if netdot 
demands postgresql, it means that these people will end up having to run 
multiple databases.  Bear in mind that netdot's target audience are network 
heads, not server people.  Lower barriers to using netdot are a good thing to 
aim for.

Can I suggest that if you're planning to support postgresql, you use a query 
abstraction layer to handle cidr/inet queries so that postgresql queries will 
run efficiently, and mysql queries will continue to work (with adequate 
performance for small installations)?
----------------------------------------
Feature #1756: Migration to Pg
https://osl.uoregon.edu/redmine/issues/1756#change-3160

Author: Carlos Vicente
Status: New
Priority: Normal
Assignee: Anton Berezin
Category: Netdot
Target version: 1.0.6
Resolution: 


As discussed previously, we would like to start supporting PostgresQL only. 
This ticket will track the migration tasks, which include:

* Using Pg's native support for IPv4 and IPv6 addresses 
* Using table partitions to keep forwarding and ARP tables for longer
* Remove MySQL-specific pieces of code
* Write script to migrate the data


-- 
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, 1 Apr 2014 09:25:43 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.5-rc1-15-g17970ca
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  17970caeb667ced8deff15fca0bdbd803ef2d147 (commit)
      from  133c1d65677d3b7485ab0ba9e928942d35546205 (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 17970caeb667ced8deff15fca0bdbd803ef2d147
Author: Carlos Vicente <[email protected]>
Date:   Tue Apr 1 12:25:34 2014 -0400

    Changes in rest/host to show PTR records and also delete associated DNS and 
DHCP records as a transaction

diff --git a/htdocs/rest/host b/htdocs/rest/host
index 534bd81..764c36e 100644
--- a/htdocs/rest/host
+++ b/htdocs/rest/host
@@ -132,7 +132,7 @@ if ( $rest->{request}->method eq 'GET' ){
        }
     }
 
-    # Get all related IPs and names from A records
+    # Get all related IPs and names
     foreach my $rr ( values %rrs ){
        foreach my $ar ( $rr->a_records ){
            my $ip = $ar->ipblock;
@@ -144,6 +144,10 @@ if ( $rest->{request}->method eq 'GET' ){
            my $rr = $ar->rr;
            $rrs{$rr->id} = $rr;
        }
+       foreach my $ptr ( $ipb->ptr_records ){
+           my $rr = $ptr->rr;
+           $rrs{$rr->id} = $rr;
+       }
     }
 
     my %ret;  # Return hash
@@ -320,26 +324,67 @@ if ( $rest->{request}->method eq 'GET' ){
        $rest->print_formatted($rest->get(obj=>$rr, depth=>0));
     }
 }elsif ( $rest->{request}->method eq 'DELETE' ){
+    
+    my @objs_to_delete;
+    
     if ( $rrid ){
-       my $rr = RR->retrieve($rrid);
-       $rest->throw(code=>Apache2::Const::NOT_FOUND, msg=>"RR not found")
-           unless $rr;
+       my $rr = RR->retrieve($rrid);
+       $rest->throw(code=>Apache2::Const::NOT_FOUND, msg=>"RR not found")
+           unless $rr;
        
-       unless ( $manager->can($user, 'delete', $rr) ){
-           $rest->throw_rest(code=>Apache2::Const::HTTP_FORBIDDEN, 
-                             msg=>"User not allowed to delete this object");
-       }
-       eval {
-           $rr->delete();
-       };
-       if ( my $e = $@ ){
+       push @objs_to_delete, $rr;
+       
+    }elsif ( $ipid ){
+       
+       my $ipb = Ipblock->retrieve($ipid);
+       $rest->throw(code=>Apache2::Const::NOT_FOUND, msg=>"IP not found")
+           unless $ipb;
+       
+       # Make sure we are only dealing with host IPs, not blocks
+       unless ( $ipb->is_address ){
            $rest->throw(code=>Apache2::Const::HTTP_BAD_REQUEST, 
-                        msg=>"Bad request: $e"); 
+                        msg=>"Bad request: Cannot operate on blocks of 
addresses"); 
        }
-    }elsif ( $ipid ){
-       $rest->throw_rest(code=>Apache2::Const::HTTP_FORBIDDEN, 
-                         msg=>"You are not allowed to delete IPs this way");
+       # Delete A records and PTR records
+       foreach my $ar ( $ipb->a_records ){
+           push @objs_to_delete, $ar->rr;
+       }
+       foreach my $ptr ( $ipb->ptr_records ){
+           push @objs_to_delete, $ptr->rr;
+       }
+       # Delete DHCP hosts
+       foreach my $scope ( $ipb->dhcp_scopes ){
+           push @objs_to_delete, $scope;
+       }
+       
+   }elsif ( $ethernet ){
+       my $phy = PhysAddr->search(address=>$ethernet)->first;
+       $rest->throw(code=>Apache2::Const::NOT_FOUND, msg=>"MAC not found") 
+           unless $phy;
+       
+       # Delete DhcpScope objects associated with this MAC
+       foreach my $host ( $phy->dhcp_hosts ){
+           push @objs_to_delete, $host;
+       }
+    }
+    
+    # Delete objects (if any) as one transaction
+    if ( @objs_to_delete ){
+       eval {
+           Netdot::Model->do_transaction( sub{ 
+               foreach my $obj ( @objs_to_delete ){
+                   unless ( $manager->can($user, 'delete', $obj) ){
+                       $rest->throw_rest(code=>Apache2::Const::HTTP_FORBIDDEN, 
+                                         msg=>"User not allowed to delete this 
object");
+                   }
+                   $obj->delete();
+               }       
+                                          });
+       };
+       if ( my $e = $@ ){
+           $rest->throw(code=>Apache2::Const::HTTP_BAD_REQUEST, 
+                        msg=>"Bad request: $e"); 
+       }
     }
-
 }
 </%perl>

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

Summary of changes:
 htdocs/rest/host | 79 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 62 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
Netdot


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

Message: 3
Date: Tue, 1 Apr 2014 09:26:17 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch master updated.
        netdot-1.0.5-rc1-15-g17970ca
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, master has been updated
       via  17970caeb667ced8deff15fca0bdbd803ef2d147 (commit)
       via  133c1d65677d3b7485ab0ba9e928942d35546205 (commit)
      from  bed532320ade03d4588e67e930fc1bbd87342a3b (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 -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 htdocs/rest/host | 81 +++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 63 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
Netdot


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

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


End of Netdot-devel Digest, Vol 85, Issue 1
*******************************************

Reply via email to