You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/06/01 17:10:20 UTC
[5/8] incubator-trafficcontrol git commit: fix some hash logic errors
fix some hash logic errors
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/64916261
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/64916261
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/64916261
Branch: refs/heads/master
Commit: 64916261e2e7586ca0383e60af4dba331ac37d50
Parents: c1486b2
Author: Derek Gelinas <de...@cable.comcast.com>
Authored: Tue May 23 20:55:48 2017 +0000
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Thu Jun 1 11:09:39 2017 -0600
----------------------------------------------------------------------
traffic_ops/app/lib/API/Server.pm | 11 +++++------
traffic_ops/app/lib/UI/Server.pm | 5 ++---
2 files changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/64916261/traffic_ops/app/lib/API/Server.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Server.pm b/traffic_ops/app/lib/API/Server.pm
index 1ffc5ef..70eeefd 100644
--- a/traffic_ops/app/lib/API/Server.pm
+++ b/traffic_ops/app/lib/API/Server.pm
@@ -967,7 +967,7 @@ sub get_servers_by_phys_loc {
return ( $forbidden, $servers );
}
- my $servers = $self->db->resultset('Server')->search( { phys_location => $phys_loc_id }, { prefetch => [ 'cdn', 'cachegroup', 'type', 'profile', 'status', 'phys_location' ] } );
+ $servers = $self->db->resultset('Server')->search( { phys_location => $phys_loc_id }, { prefetch => [ 'cdn', 'cachegroup', 'type', 'profile', 'status', 'phys_location' ] } );
return ( $forbidden, $servers );
}
@@ -997,13 +997,12 @@ sub is_server_valid {
my $cdn_mismatch;
if ($id) {
- my $profile = $self->db->resultset('Profile')->search( { 'me.id' => $params->{profileId}} )->single();
- my $profile_cdn_id = $profile->cdn;
- if ( !defined($profile_cdn_id) ) {
+ my $profile = $self->db->resultset('Profile')->search( { 'me.id' => $params->{profileId}}, { prefetch => ['cdn'] } )->single();
+ if ( !defined($profile->cdn) ) {
$cdn_mismatch = 1;
}
- elsif ( $params->{cdnId} != $profile_cdn_id ) {
- $cdn_does_not_match = 1;
+ elsif ( $params->{cdnId} != $profile->cdn->id ) {
+ $cdn_mismatch = 1;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/64916261/traffic_ops/app/lib/UI/Server.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Server.pm b/traffic_ops/app/lib/UI/Server.pm
index 3ad625a..c8da0da 100644
--- a/traffic_ops/app/lib/UI/Server.pm
+++ b/traffic_ops/app/lib/UI/Server.pm
@@ -449,11 +449,10 @@ sub check_server_input {
my $profile = $self->db->resultset('Profile')->search( { 'me.id' => $paramHashRef->{'profile'}}, { prefetch => ['cdn'] } )->single();
my $cdn = $self->db->resultset('Cdn')->search( { 'me.id' => $paramHashRef->{'cdn'} } )->single();
- my $profile_cdn = $profile->cdn;
- if ( !defined($profile_cdn) ) {
+ if ( !defined($profile->cdn) ) {
$err .= "the " . $paramHashRef->{'profile'} . " profile is not in the " . $cdn->name . " CDN." . $sep;
}
- if ( $profile_cdn != $cdn->id ) {
+ elsif ( $profile->cdn->id != $cdn->id ) {
$err .= "the " . $paramHashRef->{'profile'} . " profile is not in the " . $cdn->name . " CDN." . $sep;
}
return $err;