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.6-59-g0b887d8 ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Fri, 19 Sep 2014 10:22:27 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.6-59-g0b887d8
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 0b887d8b0bef72545ee423932b67995c11994946 (commit)
via 86bef377ffc1c894e5fc534693440d7a4a7fb702 (commit)
via 49af8c2967ee7b19a5fcf816501013b4dbb6b719 (commit)
via a377c6fac01f748bb6714b03f36654b8f78aafd8 (commit)
from 3f415fabc24a2c0a6dd24bc0218952d9dfbeec0a (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 0b887d8b0bef72545ee423932b67995c11994946
Merge: 3f415fa 86bef37
Author: Carlos Vicente <[email protected]>
Date: Fri Sep 19 13:10:51 2014 -0400
Merge branch 'update_device_api' into netdot-1.0
commit 86bef377ffc1c894e5fc534693440d7a4a7fb702
Author: Carlos Vicente <[email protected]>
Date: Fri Sep 19 13:09:41 2014 -0400
Discover device within a transaction when using rest/updatedev
diff --git a/htdocs/rest/updatedev b/htdocs/rest/updatedev
index 185d6cc..9170d86 100644
--- a/htdocs/rest/updatedev
+++ b/htdocs/rest/updatedev
@@ -37,15 +37,24 @@ $logger->info(sprintf("/rest/updatedev: %s request with
args: %s from %s (%s)",
$headers->{'User-Agent'}
));
-my $user_type = $user->getAttribute('USER_TYPE');
-
</%init>
<%perl>
my $dinfo;
if ( $method eq 'POST' ){
$dinfo = $rest->read_serialized($info);
- my $obj = Device->discover(name=>$name, info=>$dinfo);
+
+ my $obj;
+ eval {
+ Netdot::Model->do_transaction( sub{
+ $obj = Device->discover(name=>$name, info=>$dinfo);
+ });
+ };
+ if ( my $e = $@ ){
+ $rest->throw(code=>Apache2::Const::HTTP_BAD_REQUEST,
+ msg=>"Bad request: $e");
+ }
+
my $o = $rest->get(obj=>$obj);
$rest->print_serialized($o);
-----------------------------------------------------------------------
Summary of changes:
htdocs/Makefile | 2 +-
htdocs/rest/host | 8 ++---
htdocs/rest/host_contacts | 2 +-
htdocs/rest/updatedev | 63 +++++++++++++++++++++++++++++++++
lib/Netdot/Model/Device.pm | 52 ++++++++++++++++------------
lib/Netdot/REST.pm | 86 ++++++++++++++++++++++++++++++++++++----------
6 files changed, 166 insertions(+), 47 deletions(-)
create mode 100644 htdocs/rest/updatedev
hooks/post-receive
--
Netdot
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 90, Issue 4
*******************************************