You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2017/04/26 14:59:26 UTC

[1/3] incubator-trafficcontrol git commit: Change Daemonize so that parent process returns a 1 instead of a 0, also remove re-direct of output to /dev/null. Thanks @oren-shemesh for the help

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 47368bc50 -> dfdfdcabd


Change Daemonize so that parent process returns a 1 instead of a 0, also remove re-direct of output to /dev/null.  Thanks @oren-shemesh for the help


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

Branch: refs/heads/master
Commit: be8106c49306134fd6ef0258d647db7f16dd9520
Parents: 30333b3
Author: David Neuman <da...@gmail.com>
Authored: Wed Apr 26 08:26:17 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Wed Apr 26 08:45:05 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/MojoPlugins/Daemonize.pm | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/be8106c4/traffic_ops/app/lib/MojoPlugins/Daemonize.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/MojoPlugins/Daemonize.pm b/traffic_ops/app/lib/MojoPlugins/Daemonize.pm
index 7341dd2..5037031 100755
--- a/traffic_ops/app/lib/MojoPlugins/Daemonize.pm
+++ b/traffic_ops/app/lib/MojoPlugins/Daemonize.pm
@@ -24,7 +24,7 @@ sub register {
 
 	$app->renderer->add_helper(
 		# Note: Calling fork_and_daemonize() returns twice: Once for the parent and the other for the daemon (=child).
-		# Caller should check return value: 
+		# Caller should check return value:
 		#  <0 means an error occured
 		#  0 means you are the daemon (=child)
 		#  1 means you are the parent (= original process)
@@ -41,12 +41,6 @@ sub register {
 				# This is the first child
 				$self->inactivity_timeout(0);
 				POSIX::setsid();
-				open( STDIN, "< /dev/null" )
-					|| confess("Can't read /dev/null: $!");
-				open( STDOUT, "> /dev/null" )
-					|| confess("Can't write to /dev/null: $!");
-				open( STDERR, "> /dev/null" )
-					|| confess("Can't write to /dev/null: $!");
 				# First child forks daemon and exits with a value that signals the parent how the fork went
     			my $pid  = fork();
 
@@ -56,7 +50,7 @@ sub register {
 					exit(-1);
 				}
 				if ($pid > 0) {
-					# First child: Fork was OK, exit with 0 
+					# First child: Fork was OK, exit with 0
 					exit(0);
 				}
 				# This is the daemon, return 0 to caller
@@ -75,11 +69,12 @@ sub register {
 				return -1;
 			}
 
-            # Parent: Do not return $pid as this is the pid of the first child, which is not interesting
-			return 0;
+			# Parent: Do not return $pid as this is the pid of the first child, which is not interesting
+			# Return 1 to signal caller that this is the parent
+			return 1;
 		}
 	);
 
 }
 
-1;
+1;
\ No newline at end of file


[2/3] incubator-trafficcontrol git commit: Fixed and issue where a search for DSs was using a profile ID instead of cdn_id

Posted by da...@apache.org.
Fixed and issue where a search for DSs was using a profile ID instead of cdn_id

(cherry picked from commit 3f6f1cc17befc970bc0bf5cff8ff5023bd48c27c)


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

Branch: refs/heads/master
Commit: 30333b3cb4e28d2c503fda3df44cf494b1bb8225
Parents: 47368bc
Author: David Neuman <da...@gmail.com>
Authored: Tue Apr 25 15:00:09 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Wed Apr 26 08:45:05 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/API/Cdn.pm            | 11 ++++-------
 traffic_ops/app/lib/MojoPlugins/Server.pm |  3 ---
 2 files changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/30333b3c/traffic_ops/app/lib/API/Cdn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Cdn.pm b/traffic_ops/app/lib/API/Cdn.pm
index 9fa1fb7..03d7671 100644
--- a/traffic_ops/app/lib/API/Cdn.pm
+++ b/traffic_ops/app/lib/API/Cdn.pm
@@ -1089,7 +1089,6 @@ sub dnssec_keys_refresh {
 
 	# fork and daemonize so we can avoid blocking
 	my $rc = $self->fork_and_daemonize();
-
 	if ( $rc < 0 ) {
 		my $error = "Unable to fork_and_daemonize to check DNSSEC keys for refresh in the background";
 		$self->app->log->fatal($error);
@@ -1109,6 +1108,7 @@ sub refresh_keys {
 	my $self       = shift;
 	my $is_updated = 0;
 	my $error_message;
+	$self->app->log->debug("Starting refresh of DNSSEC keys");
 	my $rs_data = $self->db->resultset("Cdn")->search( {}, { order_by => "name" } );
 
 	while ( my $row = $rs_data->next ) {
@@ -1195,7 +1195,7 @@ sub refresh_keys {
 			}
 
 			#get DeliveryServices for CDN
-			my %search = ( profile => $profile_id );
+			my %search = ( cdn_id => $row->id );
 			my @ds_rs = $self->db->resultset('Deliveryservice')->search( \%search );
 			foreach my $ds (@ds_rs) {
 				if (   $ds->type->name !~ m/^HTTP/
@@ -1240,16 +1240,13 @@ sub refresh_keys {
 					#update is_updated param
 					$is_updated = 1;
 				}
-
 				#if keys do exist, check expiration
 				else {
 					my $ksk = $ds_keys->{ksk};
 					foreach my $krecord (@$ksk) {
 						my $kstatus = $krecord->{status};
-						if ( $kstatus eq 'new' ) {    #ignore anything other than the 'new' record
-							                          #check if expired
+						if ( $kstatus eq 'new' ) {
 							if ( $krecord->{expirationDate} < $key_expiration ) {
-
 								#if expired create new keys
 								$self->app->log->info("The KSK keys for $xml_id are expired!");
 								my $effective_date = $krecord->{expirationDate} - ( $dnskey_ttl * $dnskey_effective_multiplier );
@@ -1282,7 +1279,6 @@ sub refresh_keys {
 			}
 
 			if ( $is_updated == 1 ) {
-
 				# #convert hash to json and store in Riak
 				my $json_data = encode_json($keys);
 				$response_container = $self->riak_put( "dnssec", $cdn_name, $json_data );
@@ -1296,6 +1292,7 @@ sub refresh_keys {
 			}
 		}
 	}
+	$self->app->log->debug("Done refreshing DNSSEC keys");
 }
 
 sub regen_expired_keys {

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/30333b3c/traffic_ops/app/lib/MojoPlugins/Server.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/MojoPlugins/Server.pm b/traffic_ops/app/lib/MojoPlugins/Server.pm
index 139194e..bbe1df0 100755
--- a/traffic_ops/app/lib/MojoPlugins/Server.pm
+++ b/traffic_ops/app/lib/MojoPlugins/Server.pm
@@ -44,9 +44,6 @@ sub register {
 			my $helper_class       = shift || confess("Supply a Helper 'class'");
 			my $method_function    = shift || confess("Supply a Helper class 'method'");
 			my $schema_result_file = shift || confess("Supply a schema result file, ie: 'InfluxDBHostsOnline'");
-
-			$self->app->log->debug("\n\n" . $schema_result_file . "\n\n");
-
 			my $response;
 			my $active_server = $active_server_for{$schema_result_file};
 			my @rs = randomize_online_servers( $self, $schema_result_file );


[3/3] incubator-trafficcontrol git commit: This closes #521.

Posted by da...@apache.org.
This closes #521.


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

Branch: refs/heads/master
Commit: dfdfdcabd08c6c9863c3132654fd2c5ecff3ac58
Parents: be8106c
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed Apr 26 08:45:35 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Wed Apr 26 08:45:35 2017 -0600

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

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