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/29 23:07:36 UTC

[1/4] incubator-trafficcontrol git commit: This closes #384

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 4364ca7de -> 4cb23802a


This closes #384


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

Branch: refs/heads/master
Commit: 4cb23802a88ec4f7d08b40e0cb2060a40c9e832e
Parents: 2e274e1
Author: Dewayne Richardson <de...@apache.org>
Authored: Wed Mar 29 17:07:27 2017 -0600
Committer: Dewayne Richardson <de...@apache.org>
Committed: Wed Mar 29 17:07:27 2017 -0600

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

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



[2/4] incubator-trafficcontrol git commit: get rid of repeated lines

Posted by de...@apache.org.
get rid of repeated lines


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

Branch: refs/heads/master
Commit: 6ea430e4ef30c69f852cd34a3c1222ff98300363
Parents: 0ba8e52
Author: Derek Gelinas <de...@cable.comcast.com>
Authored: Mon Mar 20 14:20:18 2017 -0400
Committer: Dewayne Richardson <de...@apache.org>
Committed: Wed Mar 29 17:07:27 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/6ea430e4/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm b/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
index cd3b524..b879088 100644
--- a/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
+++ b/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
@@ -457,7 +457,6 @@ sub cdn_ds_data {
 
 	my $rs = $self->db->resultset('DeliveryServiceInfoForDomainList')->search( {}, { bind => [$cdn_obj->name] } );
 
-	print STDERR Dumper($cdn_obj->name);
 	my $j = 0;
 	while ( my $row = $rs->next ) {
 		my $org_server                  = $row->org_server_fqdn;
@@ -1042,11 +1041,15 @@ sub cacheurl_dot_config {
 	}
 	elsif ( $filename eq "cacheurl.config" ) {    # this is the global drop qstring w cacheurl use case
 		my $data = $self->cdn_ds_data( $cdn_obj );
+		my $last_org = '';
 		foreach my $remap ( @{ $data->{dslist} } ) {
 			if ( $remap->{qstring_ignore} == 1 ) {
 				my $org = $remap->{org};
-				$org =~ /(https?:\/\/)(.*)/;
-				$text .= "$1(" . $2 . "/[^?]+)(?:\\?|\$)  $1\$1\n";
+				if ( $last_org ne $org ){
+					$org =~ /(https?:\/\/)(.*)/;
+					$text .= "$1(" . $2 . "/[^?]+)(?:\\?|\$)  $1\$1\n";
+				}
+				$last_org = $org;
 			}
 		}
 


[3/4] incubator-trafficcontrol git commit: delete unneeded resultset

Posted by de...@apache.org.
delete unneeded resultset


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

Branch: refs/heads/master
Commit: 2e274e19e216dcc53b1b8595134b2177f78ebdfd
Parents: 6ea430e
Author: Derek Gelinas <de...@cable.comcast.com>
Authored: Mon Mar 20 14:25:34 2017 -0400
Committer: Dewayne Richardson <de...@apache.org>
Committed: Wed Mar 29 17:07:27 2017 -0600

----------------------------------------------------------------------
 .../Result/DeliveryServiceInfoForCdnList.pm     | 103 -------------------
 1 file changed, 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/2e274e19/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm b/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm
deleted file mode 100644
index 1e59d83..0000000
--- a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm
+++ /dev/null
@@ -1,103 +0,0 @@
-use utf8;
-
-#
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-#
-
-package Schema::Result::DeliveryServiceInfoForCdnList;
-
-# this view returns the regexp set for a delivery services, ordered by type, set_number.
-# to use, do
-#
-# $rs = $self->db->resultset('DeliveryServiceInfoForDomainList')->search({}, { bind => [ $domain ]});
-#
-# where $id is the deliveryservice id.
-
-use strict;
-use warnings;
-
-use base 'DBIx::Class::Core';
-
-__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
-
-__PACKAGE__->table("DeliveryServiceInfoForCdnList:");
-
-__PACKAGE__->result_source_instance->is_virtual(1);
-
-__PACKAGE__->result_source_instance->view_definition( "
-SELECT
-    deliveryservice.xml_id,
-    deliveryservice.id AS ds_id,
-    deliveryservice.dscp,
-    deliveryservice.signed,
-    deliveryservice.qstring_ignore,
-    deliveryservice.org_server_fqdn,
-    deliveryservice.multi_site_origin,
-    deliveryservice.range_request_handling,
-    deliveryservice.origin_shield,
-    regex.pattern,
-    retype.name AS re_type,
-    dstype.name AS ds_type,
-    cdn.name AS domain_name,
-    deliveryservice_regex.set_number,
-    deliveryservice.edge_header_rewrite,
-    deliveryservice.mid_header_rewrite,
-    deliveryservice.regex_remap,
-    deliveryservice.cacheurl,
-    deliveryservice.remap_text,
-    deliveryservice.protocol,
-    deliveryservice.profile
-FROM
-    deliveryservice
-    JOIN deliveryservice_regex ON deliveryservice_regex.deliveryservice = deliveryservice.id
-    JOIN regex ON deliveryservice_regex.regex = regex.id
-    JOIN type as retype ON regex.type = retype.id
-    JOIN type as dstype ON deliveryservice.type = dstype.id
-    JOIN cdn ON cdn.id = deliveryservice.cdn_id
-WHERE
-    deliveryservice.cdn_id = ? 
-    AND parameter.name = 'domain_name'
-ORDER BY
-    ds_id,
-    re_type,
-    set_number"
-);
-
-__PACKAGE__->add_columns(
-	"xml_id",          { data_type => "varchar", is_nullable => 0, size => 45 },
-	"org_server_fqdn", { data_type => "varchar", is_nullable => 0, size => 45 },
-	"multi_site_origin",           { data_type => "integer", is_nullable => 0 },
-	"ds_id",                       { data_type => "integer", is_nullable => 0 },
-	"dscp",                        { data_type => "integer", is_nullable => 0 },
-	"signed",                      { data_type => "integer", is_nullable => 0 },
-	"qstring_ignore",              { data_type => "integer", is_nullable => 0 },
-	"pattern",                     { data_type => "varchar", is_nullable => 0, size => 45 },
-	"re_type",                     { data_type => "varchar", is_nullable => 0, size => 45 },
-	"ds_type",                     { data_type => "varchar", is_nullable => 0, size => 45 },
-	"set_number",                  { data_type => "integer", is_nullable => 0 },
-	"domain_name",                 { data_type => "varchar", is_nullable => 0, size => 45 },
-	"edge_header_rewrite",         { data_type => "varchar", is_nullable => 0, size => 1024 },
-	"mid_header_rewrite",          { data_type => "varchar", is_nullable => 0, size => 1024 },
-	"regex_remap",                 { data_type => "varchar", is_nullable => 0, size => 1024 },
-	"cacheurl",                    { data_type => "varchar", is_nullable => 0, size => 1024 },
-	"remap_text",                  { data_type => "varchar", is_nullable => 0, size => 2048 },
-	"protocol",                    { data_type => "tinyint", is_nullable => 0, size => 4 },
-	"range_request_handling",      { data_type => "tinyint", is_nullable => 0, size => 4 },
-	"origin_shield",               { data_type => "varchar", is_nullable => 0, size => 1024 },
-	"profile",                     { data_type => "integer", is_nullable => 1},
-);
-
-1;


[4/4] incubator-trafficcontrol git commit: fix domain search

Posted by de...@apache.org.
fix domain search


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

Branch: refs/heads/master
Commit: 0ba8e528b3d7db0f8ccb95fc9aa9d07818a0f969
Parents: 4364ca7
Author: Derek Gelinas <de...@cable.comcast.com>
Authored: Mon Mar 20 14:03:47 2017 -0400
Committer: Dewayne Richardson <de...@apache.org>
Committed: Wed Mar 29 17:07:27 2017 -0600

----------------------------------------------------------------------
 .../app/lib/API/Configs/ApacheTrafficServer.pm  | 11 +++---
 .../Result/DeliveryServiceInfoForCdnList.pm     | 40 ++++++++++----------
 .../Result/DeliveryServiceInfoForDomainList.pm  |  2 +-
 3 files changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0ba8e528/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm b/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
index 1485da6..cd3b524 100644
--- a/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
+++ b/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
@@ -452,11 +452,12 @@ sub profile_param_value {
 #gets the delivery service data for an entire CDN.
 sub cdn_ds_data {
 	my $self = shift;
-	my $id   = shift;
+	my $cdn_obj   = shift;
 	my $dsinfo;
 
-	my $rs;
-	$rs = $self->db->resultset('DeliveryServiceInfoForCdnList')->search( {}, { bind => [$id] } );
+	my $rs = $self->db->resultset('DeliveryServiceInfoForDomainList')->search( {}, { bind => [$cdn_obj->name] } );
+
+	print STDERR Dumper($cdn_obj->name);
 	my $j = 0;
 	while ( my $row = $rs->next ) {
 		my $org_server                  = $row->org_server_fqdn;
@@ -476,7 +477,6 @@ sub cdn_ds_data {
 		my $cacheurl                    = $row->cacheurl;
 		my $remap_text                  = $row->remap_text;
 		my $multi_site_origin           = $row->multi_site_origin;
-		my $multi_site_origin_algorithm = $row->multi_site_origin_algorithm;
 
 		if ( $re_type eq 'HOST_REGEXP' ) {
 			my $host_re = $row->pattern;
@@ -545,7 +545,6 @@ sub cdn_ds_data {
 		$dsinfo->{dslist}->[$j]->{"cacheurl"}                    = $cacheurl;
 		$dsinfo->{dslist}->[$j]->{"remap_text"}                  = $remap_text;
 		$dsinfo->{dslist}->[$j]->{"multi_site_origin"}           = $multi_site_origin;
-		$dsinfo->{dslist}->[$j]->{"multi_site_origin_algorithm"} = $multi_site_origin_algorithm;
 
 		if ( defined($edge_header_rewrite) ) {
 			my $fname = "hdr_rw_" . $ds_xml_id . ".config";
@@ -1042,7 +1041,7 @@ sub cacheurl_dot_config {
 		}
 	}
 	elsif ( $filename eq "cacheurl.config" ) {    # this is the global drop qstring w cacheurl use case
-		my $data = $self->cdn_ds_data( $cdn_obj->id );
+		my $data = $self->cdn_ds_data( $cdn_obj );
 		foreach my $remap ( @{ $data->{dslist} } ) {
 			if ( $remap->{qstring_ignore} == 1 ) {
 				my $org = $remap->{org};

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0ba8e528/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm b/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm
index b5e91a1..1e59d83 100644
--- a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm
+++ b/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm
@@ -1,3 +1,4 @@
+use utf8;
 
 #
 #
@@ -21,13 +22,13 @@ package Schema::Result::DeliveryServiceInfoForCdnList;
 # this view returns the regexp set for a delivery services, ordered by type, set_number.
 # to use, do
 #
-# $rs = $self->db->resultset('DeliveryServiceInfoForCdnList')->search({}, { bind => [ $id ]});
+# $rs = $self->db->resultset('DeliveryServiceInfoForDomainList')->search({}, { bind => [ $domain ]});
 #
-# where $id is the CDN id.
+# where $id is the deliveryservice id.
 
 use strict;
 use warnings;
-use utf8;
+
 use base 'DBIx::Class::Core';
 
 __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
@@ -37,7 +38,7 @@ __PACKAGE__->table("DeliveryServiceInfoForCdnList:");
 __PACKAGE__->result_source_instance->is_virtual(1);
 
 __PACKAGE__->result_source_instance->view_definition( "
-SELECT DISTINCT
+SELECT
     deliveryservice.xml_id,
     deliveryservice.id AS ds_id,
     deliveryservice.dscp,
@@ -45,44 +46,40 @@ SELECT DISTINCT
     deliveryservice.qstring_ignore,
     deliveryservice.org_server_fqdn,
     deliveryservice.multi_site_origin,
-    deliveryservice.multi_site_origin_algorithm,
     deliveryservice.range_request_handling,
     deliveryservice.origin_shield,
     regex.pattern,
     retype.name AS re_type,
     dstype.name AS ds_type,
-    parameter.value AS domain_name,
+    cdn.name AS domain_name,
     deliveryservice_regex.set_number,
     deliveryservice.edge_header_rewrite,
     deliveryservice.mid_header_rewrite,
     deliveryservice.regex_remap,
     deliveryservice.cacheurl,
     deliveryservice.remap_text,
-    deliveryservice.protocol
+    deliveryservice.protocol,
+    deliveryservice.profile
 FROM
     deliveryservice
-        JOIN deliveryservice_regex ON deliveryservice_regex.deliveryservice = deliveryservice.id
-        JOIN regex ON deliveryservice_regex.regex = regex.id
-        JOIN type as retype ON regex.type = retype.id
-        JOIN type as dstype ON deliveryservice.type = dstype.id
-        JOIN profile_parameter ON deliveryservice.profile = profile_parameter.profile
-        JOIN parameter ON parameter.id = profile_parameter.parameter
-        JOIN deliveryservice_server ON deliveryservice_server.deliveryservice = deliveryservice.id
-        JOIN server ON deliveryservice_server.server = server.id
-WHERE 
+    JOIN deliveryservice_regex ON deliveryservice_regex.deliveryservice = deliveryservice.id
+    JOIN regex ON deliveryservice_regex.regex = regex.id
+    JOIN type as retype ON regex.type = retype.id
+    JOIN type as dstype ON deliveryservice.type = dstype.id
+    JOIN cdn ON cdn.id = deliveryservice.cdn_id
+WHERE
     deliveryservice.cdn_id = ? 
     AND parameter.name = 'domain_name'
-ORDER BY 
-    ds_id, 
-    re_type , 
-    deliveryservice_regex.set_number"
+ORDER BY
+    ds_id,
+    re_type,
+    set_number"
 );
 
 __PACKAGE__->add_columns(
 	"xml_id",          { data_type => "varchar", is_nullable => 0, size => 45 },
 	"org_server_fqdn", { data_type => "varchar", is_nullable => 0, size => 45 },
 	"multi_site_origin",           { data_type => "integer", is_nullable => 0 },
-	"multi_site_origin_algorithm", { data_type => "tinyint", is_nullable => 1 },
 	"ds_id",                       { data_type => "integer", is_nullable => 0 },
 	"dscp",                        { data_type => "integer", is_nullable => 0 },
 	"signed",                      { data_type => "integer", is_nullable => 0 },
@@ -100,6 +97,7 @@ __PACKAGE__->add_columns(
 	"protocol",                    { data_type => "tinyint", is_nullable => 0, size => 4 },
 	"range_request_handling",      { data_type => "tinyint", is_nullable => 0, size => 4 },
 	"origin_shield",               { data_type => "varchar", is_nullable => 0, size => 1024 },
+	"profile",                     { data_type => "integer", is_nullable => 1},
 );
 
 1;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0ba8e528/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm b/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm
index 20788c8..a3c1bc5 100644
--- a/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm
+++ b/traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForDomainList.pm
@@ -68,7 +68,7 @@ FROM
     JOIN type as dstype ON deliveryservice.type = dstype.id
     JOIN cdn ON cdn.id = deliveryservice.cdn_id
 WHERE
-    cdn.domain_name = ?
+    cdn.name = ?
     AND deliveryservice.id in (
         SELECT
             deliveryservice_server.deliveryservice