trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [3/4] incubator-trafficcontrol git commit: filter out headers when no_header parameter is present
Date Tue, 11 Jul 2017 17:20:40 GMT
filter out headers when no_header parameter is present


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

Branch: refs/heads/master
Commit: 4d31f3f7c6c515850a2dc2001aea1dc4de350007
Parents: db8e295
Author: Derek Gelinas <derek_gelinas@cable.comcast.com>
Authored: Tue Jun 13 20:27:12 2017 +0000
Committer: Jeff Elsloo <jeffrey_elsloo@cable.comcast.com>
Committed: Tue Jul 11 11:20:13 2017 -0600

----------------------------------------------------------------------
 .../app/lib/API/Configs/ApacheTrafficServer.pm  | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4d31f3f7/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 2b02b49..a865165 100644
--- a/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
+++ b/traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm
@@ -1005,12 +1005,18 @@ sub take_and_bake_server {
 	my $filename   = shift;
 
 	my $data = $self->param_data( $server_obj, $filename );
-	my $text = $self->header_comment( $server_obj->host_name );
+	my $header = $self->header_comment( $server_obj->host_name );
+	my $text;
 	foreach my $parameter ( sort keys %{$data} ) {
+		if ( $parameter eq "no_header" ) {
+			$header = "";
+		}
 		$text .= $data->{$parameter} . "\n";
 	}
+
 	$text =~ s/\s*__RETURN__\s*/\n/g;
-	return $text;
+	my $response = $header . $text;
+	return $response;
 }
 
 #generates a generic config file based on a profile and parameters which match the supplied
filename.
@@ -1020,12 +1026,18 @@ sub take_and_bake_profile {
 	my $filename    = shift;
 
 	my $data = $self->profile_param_data( $profile_obj->id, $filename );
-	my $text = $self->header_comment( $profile_obj->name );
+	my $header = $self->header_comment( $profile_obj->name );
+	my $text;
 	foreach my $parameter ( sort keys %{$data} ) {
+		if ( $parameter eq "no_header" ) {
+			$header = "";
+		}
 		$text .= $data->{$parameter} . "\n";
 	}
+	
 	$text =~ s/\s*__RETURN__\s*/\n/g;
-	return $text;
+	my $response = $header . $text;
+	return $response;
 }
 
 #generates a generic config file based on a profile and parameters which match the supplied
filename.


Mime
View raw message