You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2017/03/14 15:37:37 UTC

[3/3] incubator-trafficcontrol git commit: ds profile is now optional per PR #290 - also fixed missLat and missLong

ds profile is now optional per PR #290 - also fixed missLat and missLong


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/fd50f9f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/fd50f9f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/fd50f9f8

Branch: refs/heads/master
Commit: fd50f9f8e2bd5aa12ecc4ce9595110acbfb15cfa
Parents: 271b8b9
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Mar 13 21:07:11 2017 -0600
Committer: Dewayne Richardson <de...@apache.org>
Committed: Tue Mar 14 09:37:28 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/API/Deliveryservice.pm | 45 ++++++++++++-------------
 1 file changed, 22 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/fd50f9f8/traffic_ops/app/lib/API/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index 88935fc..d3cb6b2 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -91,7 +91,7 @@ sub index {
 				"maxDnsAnswers"            => $row->max_dns_answers,
 				"midHeaderRewrite"         => $row->mid_header_rewrite,
 				"missLat"                  => defined($row->miss_lat) ? 0.0 + $row->miss_lat : undef,
-				"missLat"                  => defined($row->miss_long) ? 0.0 + $row->miss_long : undef,
+				"missLong"                 => defined($row->miss_long) ? 0.0 + $row->miss_long : undef,
 				"multiSiteOrigin"          => \$row->multi_site_origin,
 				"orgServerFqdn"            => $row->org_server_fqdn,
 				"originShield"             => $row->origin_shield,
@@ -187,7 +187,7 @@ sub show {
 				"maxDnsAnswers"            => $row->max_dns_answers,
 				"midHeaderRewrite"         => $row->mid_header_rewrite,
 				"missLat"                  => defined($row->miss_lat) ? 0.0 + $row->miss_lat : undef,
-				"missLat"                  => defined($row->miss_long) ? 0.0 + $row->miss_long : undef,
+				"missLong"                 => defined($row->miss_long) ? 0.0 + $row->miss_long : undef,
 				"multiSiteOrigin"          => \$row->multi_site_origin,
 				"orgServerFqdn"            => $row->org_server_fqdn,
 				"originShield"             => $row->origin_shield,
@@ -331,14 +331,14 @@ sub update {
 				"longDesc2"                => $rs->long_desc_2,
 				"maxDnsAnswers"            => $rs->max_dns_answers,
 				"midHeaderRewrite"         => $rs->mid_header_rewrite,
-				"missLat"                  => 0.0 + $rs->miss_lat,
-				"missLong"                 => 0.0 + $rs->miss_long,
+				"missLat"                  => defined($rs->miss_lat) ? 0.0 + $rs->miss_lat : undef,
+				"missLong"                 => defined($rs->miss_long) ? 0.0 + $rs->miss_long : undef,
 				"multiSiteOrigin"          => $rs->multi_site_origin,
 				"orgServerFqdn"            => $rs->org_server_fqdn,
 				"originShield"             => $rs->origin_shield,
-				"profileId"                => $rs->profile->id,
-				"profileName"              => $rs->profile->name,
-				"profileDescription"       => $rs->profile->description,
+				"profileId"                => defined($rs->profile) ? $rs->profile->id : undef,
+				"profileName"              => defined($rs->profile) ? $rs->profile->name : undef,
+				"profileDescription"       => defined($rs->profile) ? $rs->profile->description : undef,
 				"protocol"                 => $rs->protocol,
 				"qstringIgnore"            => $rs->qstring_ignore,
 				"rangeRequestHandling"     => $rs->range_request_handling,
@@ -485,14 +485,14 @@ sub create {
 				"longDesc2"                => $insert->long_desc_2,
 				"maxDnsAnswers"            => $insert->max_dns_answers,
 				"midHeaderRewrite"         => $insert->mid_header_rewrite,
-				"missLat"                  => $insert->miss_lat,
-				"missLong"                 => $insert->miss_long,
+				"missLat"                  => defined($insert->miss_lat) ? 0.0 + $insert->miss_lat : undef,
+				"missLong"                 => defined($insert->miss_long) ? 0.0 + $insert->miss_long : undef,
 				"multiSiteOrigin"          => $insert->multi_site_origin,
 				"orgServerFqdn"            => $insert->org_server_fqdn,
 				"originShield"             => $insert->origin_shield,
-				"profileId"                => $insert->profile->id,
-				"profileName"              => $insert->profile->name,
-				"profileDescription"       => $insert->profile->description,
+				"profileId"                => defined($insert->profile) ? $insert->profile->id : undef,
+				"profileName"              => defined($insert->profile) ? $insert->profile->name : undef,
+				"profileDescription"       => defined($insert->profile) ? $insert->profile->description : undef,
 				"protocol"                 => $insert->protocol,
 				"qstringIgnore"            => $insert->qstring_ignore,
 				"rangeRequestHandling"     => $insert->range_request_handling,
@@ -597,14 +597,14 @@ sub get_deliveryservices_by_serverId {
 					"longDesc2"                => $row->long_desc_2,
 					"maxDnsAnswers"            => $row->max_dns_answers,
 					"midHeaderRewrite"         => $row->mid_header_rewrite,
-					"missLat"                  => $row->miss_lat,
-					"missLong"                 => $row->miss_long,
+					"missLat"                  => defined($row->miss_lat) ? 0.0 + $row->miss_lat : undef,
+					"missLong"                 => defined($row->miss_long) ? 0.0 + $row->miss_long : undef,
 					"multiSiteOrigin"          => \$row->multi_site_origin,
 					"orgServerFqdn"            => $row->org_server_fqdn,
 					"originShield"             => $row->origin_shield,
-					"profileId"                => $row->profile->id,
-					"profileName"              => $row->profile->name,
-					"profileDescription"       => $row->profile->description,
+					"profileId"                => defined($row->profile) ? $row->profile->id : undef,
+					"profileName"              => defined($row->profile) ? $row->profile->name : undef,
+					"profileDescription"       => defined($row->profile) ? $row->profile->description : undef,
 					"protocol"                 => $row->protocol,
 					"qstringIgnore"            => $row->qstring_ignore,
 					"rangeRequestHandling"     => $row->range_request_handling,
@@ -671,14 +671,14 @@ sub get_deliveryservices_by_userId {
 					"longDesc2"                => $row->long_desc_2,
 					"maxDnsAnswers"            => $row->max_dns_answers,
 					"midHeaderRewrite"         => $row->mid_header_rewrite,
-					"missLat"                  => $row->miss_lat,
-					"missLong"                 => $row->miss_long,
+					"missLat"                  => defined($row->miss_lat) ? 0.0 + $row->miss_lat : undef,
+					"missLong"                 => defined($row->miss_long) ? 0.0 + $row->miss_long : undef,
 					"multiSiteOrigin"          => \$row->multi_site_origin,
 					"orgServerFqdn"            => $row->org_server_fqdn,
 					"originShield"             => $row->origin_shield,
-					"profileId"                => $row->profile->id,
-					"profileName"              => $row->profile->name,
-					"profileDescription"       => $row->profile->description,
+					"profileId"                => defined($row->profile) ? $row->profile->id : undef,
+					"profileName"              => defined($row->profile) ? $row->profile->name : undef,
+					"profileDescription"       => defined($row->profile) ? $row->profile->description : undef,
 					"protocol"                 => $row->protocol,
 					"qstringIgnore"            => $row->qstring_ignore,
 					"rangeRequestHandling"     => $row->range_request_handling,
@@ -945,7 +945,6 @@ sub is_deliveryservice_valid {
 			missLong             => [ \&is_valid_long ],
 			multiSiteOrigin      => [ is_required("is required") ],
 			orgServerFqdn        => [ is_required("is required"), is_like( qr/^(https?:\/\/)/, "must start with http:// or https://" ) ],
-			profileId            => [ is_required("is required") ],
 			protocol             => [ is_required("is required") ],
 			qstringIgnore        => [ is_required("is required") ],
 			rangeRequestHandling => [ is_required("is required") ],