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 - Bug #1690] (New) Wrong name when adding same
manufacturer with different sysObjectOids ([email protected])
2. [Netdot - Bug #1690] Wrong name when adding same manufacturer
with different sysObjectOids ([email protected])
3. [SCM] UNNAMED PROJECT branch netdot-1.0 updated.
netdot-1.0.1-41-g10cea65 ([email protected])
4. [SCM] UNNAMED PROJECT branch netdot-1.0 updated.
netdot-1.0.1-42-g7774c71 ([email protected])
5. [Netdot - Bug #1690] (Resolved) Wrong name when adding same
manufacturer with different sysObjectOids ([email protected])
6. [SCM] UNNAMED PROJECT branch netdot-1.0 updated.
netdot-1.0.1-43-gccb6aec ([email protected])
7. [Netdot - Bug #1689] (Resolved) Site Type Model Report
showing Unknown instead of the manufacturer ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Mon, 24 Sep 2012 00:56:39 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1690] (New) Wrong name when
adding same manufacturer with different sysObjectOids
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1690 has been reported by Matej Vadnjal.
----------------------------------------
Bug #1690: Wrong name when adding same manufacturer with different sysObjectOids
https://osl.uoregon.edu/redmine/issues/1690
Author: Matej Vadnjal
Status: New
Priority: Normal
Assignee:
Category:
Target version:
Resolution:
In lib/Netdot/Model/Product.pm there is this code:
sub insert {
...
if ( $ent->oid ne $oid ) {
# There is an entity with the same name and different oid
# Use the OID as part of the name to make a unique new one
my $entname = "$argv->{manufacturer} ($oid)";
$ent = Entity->insert({name=>$entname, oid=>$oid});
}
...
}
$argv->{manufacturer} is an Entity object:
print Dumper $argv;
DEBUG - $VAR1 = {
'sysobjectid' => '1.3.6.1.4.1.2254.2.4',
'part_number' => undef,
'manufacturer' => bless( {
'info' => undef,
'maint_contract' => undef,
'short_name' => undef,
'acctnumber' => undef,
'oid' => '1.3.6.1.4.1.4555',
'name' => 'Socomec',
'asnumber' => undef,
'asname' => undef,
'config_type' => undef,
'__triggers' => {},
'availability' => undef,
'_class_trigger_results' => [
[],
[]
],
'contactlist' => undef,
'aliases' => undef,
'id' => '49'
}, 'Entity' ),
'name' => 'NETYS RT 1/1 UPS',
'type' => bless( {
'__triggers' => {},
'_class_trigger_results' => [],
'name' => 'Unknown',
'id' => '12'
}, 'ProductType' ),
'description' => undef
};
This line in above code:
my $entname = "$argv->{manufacturer} ($oid)";
sets $entname to:
"49 (1.3.6.1.4.1.4555)"
when it should be:
"Socomec (1.3.6.1.4.1.4555)"
So apparently calling Entity in scalar context returns the value of id, not
name. If this is the desired behavior, the above code should explicitly call
the name property:
my $entname = "$argv->{manufacturer}->{name} ($oid)";
--
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: Mon, 24 Sep 2012 01:01:00 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1690] Wrong name when adding
same manufacturer with different sysObjectOids
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1690 has been updated by Matej Vadnjal.
I apologize for forgetting to format the code in original post. Let me try
again.
In lib/Netdot/Model/Product.pm there is this code:
<pre>
sub insert {
...
if ( $ent->oid ne $oid ) {
# There is an entity with the same name and different oid
# Use the OID as part of the name to make a unique new one
my $entname = "$argv->{manufacturer} ($oid)";
$ent = Entity->insert({name=>$entname, oid=>$oid});
}
...
}
</pre>
$argv->{manufacturer} is an Entity object:
<pre>
print Dumper $argv;
DEBUG - $VAR1 = {
'sysobjectid' => '1.3.6.1.4.1.2254.2.4',
'part_number' => undef,
'manufacturer' => bless( {
'info' => undef,
'maint_contract' => undef,
'short_name' => undef,
'acctnumber' => undef,
'oid' => '1.3.6.1.4.1.4555',
'name' => 'Socomec',
'asnumber' => undef,
'asname' => undef,
'config_type' => undef,
'__triggers' => {},
'availability' => undef,
'_class_trigger_results' => [
[],
[]
],
'contactlist' => undef,
'aliases' => undef,
'id' => '49'
}, 'Entity' ),
'name' => 'NETYS RT 1/1 UPS',
'type' => bless( {
'__triggers' => {},
'_class_trigger_results' => [],
'name' => 'Unknown',
'id' => '12'
}, 'ProductType' ),
'description' => undef
};
</pre>
This line in above code:
<pre>
my $entname = "$argv->{manufacturer} ($oid)";
</pre>
sets $entname to:
"49 (1.3.6.1.4.1.4555)"
when it should be:
"Socomec (1.3.6.1.4.1.4555)"
So apparently calling Entity in scalar context returns the value of id, not
name. If this is the desired behavior, the above code should explicitly call
the name property:
<pre>
my $entname = "$argv->{manufacturer}->{name} ($oid)";
</pre>
----------------------------------------
Bug #1690: Wrong name when adding same manufacturer with different sysObjectOids
https://osl.uoregon.edu/redmine/issues/1690#change-2963
Author: Matej Vadnjal
Status: New
Priority: Normal
Assignee:
Category:
Target version:
Resolution:
In lib/Netdot/Model/Product.pm there is this code:
sub insert {
...
if ( $ent->oid ne $oid ) {
# There is an entity with the same name and different oid
# Use the OID as part of the name to make a unique new one
my $entname = "$argv->{manufacturer} ($oid)";
$ent = Entity->insert({name=>$entname, oid=>$oid});
}
...
}
$argv->{manufacturer} is an Entity object:
print Dumper $argv;
DEBUG - $VAR1 = {
'sysobjectid' => '1.3.6.1.4.1.2254.2.4',
'part_number' => undef,
'manufacturer' => bless( {
'info' => undef,
'maint_contract' => undef,
'short_name' => undef,
'acctnumber' => undef,
'oid' => '1.3.6.1.4.1.4555',
'name' => 'Socomec',
'asnumber' => undef,
'asname' => undef,
'config_type' => undef,
'__triggers' => {},
'availability' => undef,
'_class_trigger_results' => [
[],
[]
],
'contactlist' => undef,
'aliases' => undef,
'id' => '49'
}, 'Entity' ),
'name' => 'NETYS RT 1/1 UPS',
'type' => bless( {
'__triggers' => {},
'_class_trigger_results' => [],
'name' => 'Unknown',
'id' => '12'
}, 'ProductType' ),
'description' => undef
};
This line in above code:
my $entname = "$argv->{manufacturer} ($oid)";
sets $entname to:
"49 (1.3.6.1.4.1.4555)"
when it should be:
"Socomec (1.3.6.1.4.1.4555)"
So apparently calling Entity in scalar context returns the value of id, not
name. If this is the desired behavior, the above code should explicitly call
the name property:
my $entname = "$argv->{manufacturer}->{name} ($oid)";
--
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: Mon, 24 Sep 2012 07:27:07 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] UNNAMED PROJECT branch netdot-1.0
updated. netdot-1.0.1-41-g10cea65
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 "UNNAMED PROJECT".
The branch, netdot-1.0 has been updated
via 10cea65420273d1ddc8d1bb69fef8443d25d11f4 (commit)
from 26d440b956fb42b84f0081161007130a5eb433ed (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 10cea65420273d1ddc8d1bb69fef8443d25d11f4
Author: Carlos Vicente <[email protected]>
Date: Mon Sep 24 10:26:12 2012 -0400
DNS name validation for regular users was applied in wrong places. Added
'*' as a valid character for DNS names (only admins can add)
diff --git a/htdocs/rest/host b/htdocs/rest/host
index 6c0f9f1..4cb7d0b 100644
--- a/htdocs/rest/host
+++ b/htdocs/rest/host
@@ -41,6 +41,9 @@ $logger->info(sprintf("/rest/host: %s request with args: %s
from %s (%s)",
$rest->{request}->connection->remote_ip,
$headers->{'User-Agent'}
));
+
+my $user_type = $user->getAttribute('USER_TYPE');
+
my %rrs;
my %ips;
@@ -174,6 +177,18 @@ if ( $rest->{request}->method eq 'GET' ){
foreach my $rarg ( qw/name expiration info/ ){
$args{$rarg} = $ARGS{$rarg};
}
+
+ # Hostname validation
+ if ( $args{name} && $user_type ne "Admin" ) {
+ eval {
+ RR->validate_name($args{name});
+ };
+ if ( my $e = $@ ){
+ $rest->throw(code=>Apache2::Const::HTTP_BAD_REQUEST,
+ msg=>"Bad request: $e");
+ }
+ }
+
eval {
$rr->update(\%args);
};
@@ -233,7 +248,19 @@ if ( $rest->{request}->method eq 'GET' ){
}else{
# No rrid or ipid means We're adding a new host
my %add_args;
+
+ if ( $name && $user_type ne "Admin" ) {
+ # Hostname validation
+ eval {
+ RR->validate_name($name);
+ };
+ if ( my $e = $@ ){
+ $rest->throw(code=>Apache2::Const::HTTP_BAD_REQUEST,
+ msg=>"Bad request: $e");
+ }
+ }
$add_args{name} = $name;
+
foreach my $arg (qw/subnet expiration aliases cpu os info/ ){
$add_args{$arg} = $ARGS{$arg};
}
diff --git a/htdocs/user_management/add_host.html
b/htdocs/user_management/add_host.html
index 2a357fd..072f2cb 100644
--- a/htdocs/user_management/add_host.html
+++ b/htdocs/user_management/add_host.html
@@ -78,6 +78,17 @@ if ( $submit ){
foreach my $key ( qw(name expiration ethernet duid aliases) ){
$args{$key} = $ARGS{$key};
}
+
+ # Hostname validation
+ if ( $args{name} ) {
+ eval {
+ RR->validate_name($args{name});
+ };
+ if ( my $e = $@ ){
+ $m->comp('/generic/error.mhtml', error=>"$e");
+ }
+ }
+
my $person = $ui->get_user_person($user);
$args{person} = $person;
$args{zone} = $zone;
diff --git a/htdocs/user_management/hostinfo_tasks.html
b/htdocs/user_management/hostinfo_tasks.html
index d0cbb90..1f0d5ba 100644
--- a/htdocs/user_management/hostinfo_tasks.html
+++ b/htdocs/user_management/hostinfo_tasks.html
@@ -69,11 +69,9 @@ if ( exists $ao->{Ipblock} ){
if ( $ip->status->name eq 'Subnet' ){
$ipblocks{$id} = $ip;
}elsif ( $ip->status->name eq 'Container' ){
- foreach my $chid ( @{ $ip->get_descendants(no_addresses=>1) } ){
- if ( my $ch = Ipblock->retrieve($chid) ){
- if ( $ch->status->name eq 'Subnet' ){
- $ipblocks{$chid} = $ch;
- }
+ foreach my $ch ( @{ $ip->get_descendants(no_addresses=>1) } ){
+ if ( $ch->status->name eq 'Subnet' ){
+ $ipblocks{$ch->id} = $ch;
}
}
}
diff --git a/lib/Netdot/Model/RR.pm b/lib/Netdot/Model/RR.pm
index 1de44ab..62ab0ca 100644
--- a/lib/Netdot/Model/RR.pm
+++ b/lib/Netdot/Model/RR.pm
@@ -500,8 +500,6 @@ sub add_host {
$class->throw_user("Invalid zone: $argv{zone}")
unless $zone;
- # Hostname validation
- RR->validate_name($argv{name});
if ( my $h = RR->search(name=>$argv{name}, zone=>$zone)->first ){
$class->throw_user($h->get_label." is already taken");
}
@@ -533,7 +531,6 @@ sub add_host {
if ( my $h = RR->search(name=>$alias, zone=>$zone)->first ){
$class->throw_user($h->get_label." from your aliases
list is already taken");
}
- RR->validate_name($alias);
push @cnames, $alias;
}
@@ -607,7 +604,7 @@ sub validate_name {
return 1;
}
if ( $name =~ /$regex/ ){
- $self->throw_user("Invalid name: $name. Name contains invalid
characters");
+ $self->throw_user("Name $name contains characters not allowed in
this context");
}
}
1;
@@ -685,7 +682,7 @@ sub _validate_args {
}
# Valid characters
- if ( $name =~ /[^A-Za-z0-9\.\-_@]/ ){
+ if ( $name =~ /[^A-Za-z0-9\.\-_@\*]/ ){
$self->throw_user("Invalid name: $name. Contains invalid
characters");
}
# Underscore only allowed at beginning of string or dotted section
-----------------------------------------------------------------------
Summary of changes:
htdocs/rest/host | 27 +++++++++++++++++++++++++++
htdocs/user_management/add_host.html | 11 +++++++++++
htdocs/user_management/hostinfo_tasks.html | 8 +++-----
lib/Netdot/Model/RR.pm | 7 ++-----
4 files changed, 43 insertions(+), 10 deletions(-)
hooks/post-receive
--
UNNAMED PROJECT
------------------------------
Message: 4
Date: Mon, 24 Sep 2012 07:39:02 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] UNNAMED PROJECT branch netdot-1.0
updated. netdot-1.0.1-42-g7774c71
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 "UNNAMED PROJECT".
The branch, netdot-1.0 has been updated
via 7774c7189f85da20d64b433413219be52268ec20 (commit)
from 10cea65420273d1ddc8d1bb69fef8443d25d11f4 (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 7774c7189f85da20d64b433413219be52268ec20
Author: Carlos Vicente <[email protected]>
Date: Mon Sep 24 10:38:00 2012 -0400
Fix for #1690: Wrong name when adding same manufacturer with different
sysObjectOids
diff --git a/lib/Netdot/Model/Product.pm b/lib/Netdot/Model/Product.pm
index beb09de..9e41b9a 100644
--- a/lib/Netdot/Model/Product.pm
+++ b/lib/Netdot/Model/Product.pm
@@ -66,7 +66,7 @@ sub insert {
if ( $ent->oid ne $oid ) {
# There is an entity with the same name and different oid
# Use the OID as part of the name to make a unique new one
- my $entname = "$argv->{manufacturer} ($oid)";
+ my $entname = $ent->name." ($oid)";
$ent = Entity->insert({name=>$entname, oid=>$oid});
}
}else{
-----------------------------------------------------------------------
Summary of changes:
lib/Netdot/Model/Product.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
hooks/post-receive
--
UNNAMED PROJECT
------------------------------
Message: 5
Date: Mon, 24 Sep 2012 07:39:46 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1690] (Resolved) Wrong name
when adding same manufacturer with different sysObjectOids
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1690 has been updated by Carlos Vicente.
Status changed from New to Resolved
Assignee set to Carlos Vicente
Target version set to 1.0.2
Resolution set to fixed
Thank you!
----------------------------------------
Bug #1690: Wrong name when adding same manufacturer with different sysObjectOids
https://osl.uoregon.edu/redmine/issues/1690#change-2964
Author: Matej Vadnjal
Status: Resolved
Priority: Normal
Assignee: Carlos Vicente
Category:
Target version: 1.0.2
Resolution: fixed
In lib/Netdot/Model/Product.pm there is this code:
sub insert {
...
if ( $ent->oid ne $oid ) {
# There is an entity with the same name and different oid
# Use the OID as part of the name to make a unique new one
my $entname = "$argv->{manufacturer} ($oid)";
$ent = Entity->insert({name=>$entname, oid=>$oid});
}
...
}
$argv->{manufacturer} is an Entity object:
print Dumper $argv;
DEBUG - $VAR1 = {
'sysobjectid' => '1.3.6.1.4.1.2254.2.4',
'part_number' => undef,
'manufacturer' => bless( {
'info' => undef,
'maint_contract' => undef,
'short_name' => undef,
'acctnumber' => undef,
'oid' => '1.3.6.1.4.1.4555',
'name' => 'Socomec',
'asnumber' => undef,
'asname' => undef,
'config_type' => undef,
'__triggers' => {},
'availability' => undef,
'_class_trigger_results' => [
[],
[]
],
'contactlist' => undef,
'aliases' => undef,
'id' => '49'
}, 'Entity' ),
'name' => 'NETYS RT 1/1 UPS',
'type' => bless( {
'__triggers' => {},
'_class_trigger_results' => [],
'name' => 'Unknown',
'id' => '12'
}, 'ProductType' ),
'description' => undef
};
This line in above code:
my $entname = "$argv->{manufacturer} ($oid)";
sets $entname to:
"49 (1.3.6.1.4.1.4555)"
when it should be:
"Socomec (1.3.6.1.4.1.4555)"
So apparently calling Entity in scalar context returns the value of id, not
name. If this is the desired behavior, the above code should explicitly call
the name property:
my $entname = "$argv->{manufacturer}->{name} ($oid)";
--
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: 6
Date: Mon, 24 Sep 2012 07:47:38 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] UNNAMED PROJECT branch netdot-1.0
updated. netdot-1.0.1-43-gccb6aec
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 "UNNAMED PROJECT".
The branch, netdot-1.0 has been updated
via ccb6aec224a0ea1c2c97912da1e0d6752aca40ce (commit)
from 7774c7189f85da20d64b433413219be52268ec20 (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 ccb6aec224a0ea1c2c97912da1e0d6752aca40ce
Author: Carlos Vicente <[email protected]>
Date: Mon Sep 24 10:46:45 2012 -0400
#1689: Site Type Model Report showing Unknown instead of the manufacturer
diff --git a/htdocs/reports/device_inventory.html
b/htdocs/reports/device_inventory.html
index ab2bb11..148a8e1 100644
--- a/htdocs/reports/device_inventory.html
+++ b/htdocs/reports/device_inventory.html
@@ -120,13 +120,15 @@ if ( $report_type eq 'product' || $report_type eq
'product_monitored' ){
asset.product_id,
site.name AS site_name,
product.name AS product_name,
+ producttype.name AS product_type,
entity.name AS manufacturer
FROM device
LEFT JOIN site ON site.id=device.site
LEFT JOIN (asset CROSS JOIN product CROSS JOIN entity)
ON (asset.id=device.asset_id
AND asset.product_id=product.id
- AND entity.id=product.manufacturer)
+ AND entity.id=product.manufacturer)
+ LEFT JOIN producttype ON product.type = producttype.id
ORDER BY site_name,product_name
")->{rows};
@@ -135,8 +137,8 @@ if ( $report_type eq 'product' || $report_type eq
'product_monitored' ){
my %t;
foreach my $r ( @$res ) {
my $site = $r->[0] || "_unset";
- $t{$site}{name} = $r->[2] || "Unset";
my $product = $r->[1] || "_unset";
+ $t{$site}{name} = $r->[2] || "Unset";
my $type = $r->[4] || "Unset";
$t{$site}{types}{$type}{count}++;
$t{$site}{types}{$type}{prods}{$product}{name} = $r->[3] || "Unset";
-----------------------------------------------------------------------
Summary of changes:
htdocs/reports/device_inventory.html | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
hooks/post-receive
--
UNNAMED PROJECT
------------------------------
Message: 7
Date: Mon, 24 Sep 2012 07:48:19 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1689] (Resolved) Site Type
Model Report showing Unknown instead of the manufacturer
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1689 has been updated by Carlos Vicente.
Status changed from New to Resolved
Assignee set to Carlos Vicente
Target version set to 1.0.2
Resolution set to fixed
Thank you!
----------------------------------------
Bug #1689: Site Type Model Report showing Unknown instead of the manufacturer
https://osl.uoregon.edu/redmine/issues/1689#change-2965
Author: moe kraus
Status: Resolved
Priority: Normal
Assignee: Carlos Vicente
Category: UserInterface
Target version: 1.0.2
Resolution: fixed
Dear all,
there is a bug in the Report "Site Type Model". The column "Model" displays as
Manufacturer always Unknown.
I have identified this bug in the raw sql statement, reading the info from the
database. The Column product type is missing. I have tested the fixed statement:
html/reports/device_inventory.html:118
SELECT device.site,
asset.product_id,
site.name AS site_name,
product.name AS product_name,
-----> producttype.name AS product_type,
entity.name AS manufacturer
FROM device
LEFT JOIN site ON site.id=device.site
LEFT JOIN (asset CROSS JOIN product CROSS JOIN entity)
ON (asset.id=device.asset_id
AND asset.product_id=product.id
AND entity.id=product.manufacturer)
--->LEFT JOIN producttype ON product.type = producttype.id
ORDER BY site_name,product_name
--
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 66, Issue 17
********************************************