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/04/19 21:45:49 UTC

[6/8] incubator-trafficcontrol git commit: simplify getting ssl certs by hostname

simplify getting ssl certs by hostname


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

Branch: refs/heads/master
Commit: 0f6133d7df1386e0c493be4430a259b55a8acdb3
Parents: 12fa762
Author: David Neuman <da...@gmail.com>
Authored: Mon Apr 17 10:24:29 2017 -0600
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Wed Apr 19 15:45:00 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/API/DeliveryService/SslKeys.pm | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0f6133d7/traffic_ops/app/lib/API/DeliveryService/SslKeys.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/DeliveryService/SslKeys.pm b/traffic_ops/app/lib/API/DeliveryService/SslKeys.pm
index c392006..a2e1c5f 100644
--- a/traffic_ops/app/lib/API/DeliveryService/SslKeys.pm
+++ b/traffic_ops/app/lib/API/DeliveryService/SslKeys.pm
@@ -155,22 +155,9 @@ sub view_by_hostname {
 			return $self->alert( { Error => " - $key does not contain a valid domain name." } )      if !$domain_name;
 		}
 
-		my @ds_ids_regex = $self->db->resultset('Deliveryservice')
-			->search( { 'regex.pattern' => "$host_regex" }, { join => { deliveryservice_regexes => { regex => undef } } } )->get_column('id')->all();
-
 		my $cdn_id = $self->db->resultset('Cdn')->search( { domain_name => $domain_name } )->get_column('id')->single();
-		my@domain_profiles = $self->db->resultset('Profile')->search( { cdn => $cdn_id } )->get_column('id')->all();
-
-		my $rs_ds = $self->db->resultset('Deliveryservice')->search( { 'profile' => { -in => \@domain_profiles } }, {} );
-
-		my $xml_id;
-		my %ds_ids_regex = map { $_ => undef } @ds_ids_regex;
-
-		while ( my $row = $rs_ds->next ) {
-			if ( exists( $ds_ids_regex{ $row->id } ) ) {
-				$xml_id = $row->xml_id;
-			}
-		}
+		my $ds = $self->db->resultset('Deliveryservice')->search( { 'regex.pattern' => "$host_regex", 'cdn_id' => "$cdn_id" }, { join => { deliveryservice_regexes => { regex => undef } } } )->single();
+		my $xml_id = $ds->xml_id;
 
 		if ( !$version ) {
 			$version = 'latest';