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/01/17 17:10:51 UTC

[1/3] incubator-trafficcontrol git commit: ports some functionality over from ui namespace. specifically creating location params (if don't exist) for header rewrites, regex_remap and cacheurl plus creates dsnseckey if cdn is dnssecenabled.

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 2429b0a10 -> 811c6ad2a


ports some functionality over from ui namespace. specifically creating location params (if don't exist) for header rewrites, regex_remap and cacheurl plus creates dsnseckey if cdn is dnssecenabled.


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

Branch: refs/heads/master
Commit: 55175a31ba87623d180c89d01dbc1d8da2776f26
Parents: 2169b45
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Tue Jan 10 14:55:45 2017 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Tue Jan 10 14:55:45 2017 -0700

----------------------------------------------------------------------
 traffic_ops/app/lib/API/Deliveryservice.pm | 34 +++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/55175a31/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 d202691..3aaa5cc 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -263,7 +263,7 @@ sub update {
 		edge_header_rewrite         => $params->{edgeHeaderRewrite},
 		geolimit_redirect_url       => $params->{geoLimitRedirectURL},
 		geo_limit                   => $params->{geoLimit},
-		geo_limit_countries         => $params->{geoLimitCountries},
+		geo_limit_countries         => sanitize_geo_limit_countries($params->{geoLimitCountries}),
 		geo_provider                => $params->{geoProvider},
 		global_max_mbps             => $params->{globalMaxMbps},
 		global_max_tps              => $params->{globalMaxTps},
@@ -300,6 +300,12 @@ sub update {
 
 	my $rs = $ds->update($values);
 	if ($rs) {
+		# create location parameters for header_rewrite*, regex_remap* and cacheurl* config files if necessary
+		&UI::DeliveryService::header_rewrite( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{edgeHeaderRewrite}, "edge" );
+		&UI::DeliveryService::header_rewrite( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{midHeaderRewrite},  "mid" );
+		&UI::DeliveryService::regex_remap( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{regexRemap} );
+		&UI::DeliveryService::cacheurl( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{cacheurl} );
+
 		my @response;
 		push(
 			@response, {
@@ -403,7 +409,7 @@ sub create {
 		edge_header_rewrite         => $params->{edgeHeaderRewrite},
 		geolimit_redirect_url       => $params->{geoLimitRedirectURL},
 		geo_limit                   => $params->{geoLimit},
-		geo_limit_countries         => $params->{geoLimitCountries},
+		geo_limit_countries         => sanitize_geo_limit_countries($params->{geoLimitCountries}),
 		geo_provider                => $params->{geoProvider},
 		global_max_mbps             => $params->{globalMaxMbps},
 		global_max_tps              => $params->{globalMaxTps},
@@ -441,6 +447,18 @@ sub create {
 	my $insert = $self->db->resultset('Deliveryservice')->create($values);
 	my $rs     = $insert->insert();
 	if ($rs) {
+		# create location parameters for header_rewrite*, regex_remap* and cacheurl* config files if necessary
+		&UI::DeliveryService::header_rewrite( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{edgeHeaderRewrite}, "edge" );
+		&UI::DeliveryService::header_rewrite( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{midHeaderRewrite},  "mid" );
+		&UI::DeliveryService::regex_remap( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{regexRemap} );
+		&UI::DeliveryService::cacheurl( $self, $rs->id, $params->{profileId}, $params->{xmlId}, $params->{cacheurl} );
+
+		my $cdn = $self->db->resultset('Cdn')->search( { id => $params->{cdnId} } )->single();
+		my $dnssec_enabled = $cdn->dnssec_enabled;
+		if ( $dnssec_enabled ) {
+			&UI::DeliveryService::create_dnssec_keys( $self, $cdn->name, $params->{xmlId}, $rs->id );
+		}
+
 		my @response;
 		push(
 			@response, {
@@ -1007,4 +1025,16 @@ sub is_valid_long {
 	return undef;
 }
 
+sub sanitize_geo_limit_countries {
+	my $geo_limit_countries = shift;
+
+	if (!defined($geo_limit_countries)) {
+		return "";
+	}
+
+	$geo_limit_countries =~ s/\s+//g;
+	$geo_limit_countries = uc($geo_limit_countries);
+	return $geo_limit_countries;
+}
+
 1;


[3/3] incubator-trafficcontrol git commit: This closes #191 and tc-95

Posted by de...@apache.org.
This closes #191 and tc-95


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

Branch: refs/heads/master
Commit: 811c6ad2ad677b4ae177a65b3f324a9dc62e7c5d
Parents: b55f701
Author: Dewayne Richardson <de...@apache.org>
Authored: Tue Jan 17 10:10:41 2017 -0700
Committer: Dewayne Richardson <de...@apache.org>
Committed: Tue Jan 17 10:10:41 2017 -0700

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

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



[2/3] incubator-trafficcontrol git commit: Merge branch 'tc-95' of https://github.com/mitchell852/incubator-trafficcontrol

Posted by de...@apache.org.
Merge branch 'tc-95' of https://github.com/mitchell852/incubator-trafficcontrol


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

Branch: refs/heads/master
Commit: b55f7012a3c9b275ee4c6abea6d825750264ff20
Parents: 2429b0a 55175a3
Author: Dewayne Richardson <de...@apache.org>
Authored: Tue Jan 17 10:07:37 2017 -0700
Committer: Dewayne Richardson <de...@apache.org>
Committed: Tue Jan 17 10:07:37 2017 -0700

----------------------------------------------------------------------
 traffic_ops/app/lib/API/Deliveryservice.pm | 34 +++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------