You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/05/08 18:56:13 UTC

[GitHub] smalenfant closed pull request #2242: uses info api to allow ORT to retain compatibility with older builds

smalenfant closed pull request #2242: uses info api to allow ORT to retain compatibility with older builds
URL: https://github.com/apache/incubator-trafficcontrol/pull/2242
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/traffic_ops/bin/traffic_ops_ort.pl b/traffic_ops/bin/traffic_ops_ort.pl
index 00ced01bb..f0a9af3b7 100755
--- a/traffic_ops/bin/traffic_ops_ort.pl
+++ b/traffic_ops/bin/traffic_ops_ort.pl
@@ -788,12 +788,24 @@ sub get_update_status {
 
 	##Some versions of Traffic Ops had the 1.3 API but did not have the use_reval_pending field.  If this field is not present, exit.
 	if ( !defined( $upd_json->[0]->{'use_reval_pending'} ) ) {
-		( $log_level >> $ERROR ) && printf("ERROR ORT version incompatible with current version of Traffic Ops. Please upgrade to Traffic Ops 2.2.\n");
-		exit 1;
+		my $info_uri = "/api/1.2/system/info.json";
+		my $info_ref = &lwp_get($info_uri);
+		if ($info_ref eq '404') {
+			( $log_level >> $ERROR ) && printf("ERROR Unable to get status of use_reval_pending parameter.  Stopping.\n");
+			exit 1;
+		}
+		if ( $info_ref =~ m/^\d{3}$/ ) {
+			( $log_level >> $ERROR ) && print "ERROR Update URL: $info_uri returned $info_ref. Exiting, not sure what else to do.\n";
+			exit 1;
+		}
+		my $info_json = decode_json($info_ref);
+		if (defined( $info_json->{'response'}->{'parameters'}->{'use_reval_pending'} ) ) {
+			$reval_in_use = $info_json->{'response'}->{'parameters'}->{'use_reval_pending'};
+		}
+	}
+	else {
+		$reval_in_use = $upd_json->[0]->{'use_reval_pending'};
 	}
-
-	$reval_in_use = $upd_json->[0]->{'use_reval_pending'};
-	
 	return ($upd_json, $uri);
 }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services