From f571a817f855d24ebc89e4c7b45a3766261408c7 Mon Sep 17 00:00:00 2001 From: Derek Gelinas Date: Wed, 21 Feb 2018 07:19:18 -0500 Subject: [PATCH] prevents parent.config failure when no delivery services assinged --- .../lib/API/Configs/ApacheTrafficServer.pm | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm b/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm index 21a83ba5c4..b1bd4d12f2 100755 --- a/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm +++ b/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm @@ -2465,40 +2465,43 @@ sub parent_dot_config { #fix qstring - should be ignore for quika if ( !defined($data) ) { $data = $self->parent_ds_data($server_obj); } - foreach my $ds ( sort @{ $data->{dslist} } ) { - my $text; - my $org = $ds->{org}; - next if !defined $org || $org eq ""; - next if $done{$org}; - my $org_uri = URI->new($org); - if ( $ds->{type} eq "HTTP_NO_CACHE" || $ds->{type} eq "HTTP_LIVE" || $ds->{type} eq "DNS_LIVE" ) { - $text .= "dest_domain=" . $org_uri->host . " port=" . $org_uri->port . " go_direct=true\n"; - } - else { - # check for profile psel.qstring_handling. If this parameter is assigned to the server profile, - # then edges will use the qstring handling value specified in the parameter for all profiles. - - # If there is no defined parameter in the profile, then check the delivery service profile. - # If psel.qstring_handling exists in the DS profile, then we use that value for the specified DS only. - # This is used only if not overridden by a server profile qstring handling parameter. - my $ds_qsh = $qsh; - if (!defined($qsh)) { - $ds_qsh = $ds->{'param'}->{'parent.config'}->{'psel.qstring_handling'}; - } - my $parent_qstring = defined($ds_qsh) ? $ds_qsh : "ignore"; - if ( $ds->{qstring_ignore} == 0 && !defined($ds_qsh) ) { - $parent_qstring = "consider"; + if (defined($data->{dslist})) { + foreach my $ds ( sort @{ $data->{dslist} } ) { + my $text; + my $org = $ds->{org}; + next if !defined $org || $org eq ""; + next if $done{$org}; + my $org_uri = URI->new($org); + if ( $ds->{type} eq "HTTP_NO_CACHE" || $ds->{type} eq "HTTP_LIVE" || $ds->{type} eq "DNS_LIVE" ) { + $text .= "dest_domain=" . $org_uri->host . " port=" . $org_uri->port . " go_direct=true\n"; } - $text - .= "dest_domain=" - . $org_uri->host - . " port=" - . $org_uri->port - . " $parents $secparents $round_robin $go_direct qstring=$parent_qstring\n"; + else { + # check for profile psel.qstring_handling. If this parameter is assigned to the server profile, + # then edges will use the qstring handling value specified in the parameter for all profiles. + + # If there is no defined parameter in the profile, then check the delivery service profile. + # If psel.qstring_handling exists in the DS profile, then we use that value for the specified DS only. + # This is used only if not overridden by a server profile qstring handling parameter. + my $ds_qsh = $qsh; + if (!defined($qsh)) { + $ds_qsh = $ds->{'param'}->{'parent.config'}->{'psel.qstring_handling'}; + } + my $parent_qstring = defined($ds_qsh) ? $ds_qsh : "ignore"; + + if ( $ds->{qstring_ignore} == 0 && !defined($ds_qsh) ) { + $parent_qstring = "consider"; + } + $text + .= "dest_domain=" + . $org_uri->host + . " port=" + . $org_uri->port + . " $parents $secparents $round_robin $go_direct qstring=$parent_qstring\n"; + } + push @text_array, $text; + $done{$org} = 1; } - push @text_array, $text; - $done{$org} = 1; } my $default_dest_text;