trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [incubator-trafficcontrol] branch 2.2.x updated: uses info api to allow ORT to retain compatibility with older builds
Date Fri, 11 May 2018 17:09:23 GMT
This is an automated email from the ASF dual-hosted git repository.

rob pushed a commit to branch 2.2.x
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git


The following commit(s) were added to refs/heads/2.2.x by this push:
     new 8f4d1ee  uses info api to allow ORT to retain compatibility with older builds
8f4d1ee is described below

commit 8f4d1ee2aa25000a9d0e17bbf85286c4a7264eab
Author: Derek Gelinas <mrdgelinas@gmail.com>
AuthorDate: Mon May 7 18:39:06 2018 -0400

    uses info api to allow ORT to retain compatibility with older builds
    
    (cherry picked from commit e1c010922f27095b670f32ab6208afb9e9f9bc94)
---
 traffic_ops/bin/traffic_ops_ort.pl | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/traffic_ops/bin/traffic_ops_ort.pl b/traffic_ops/bin/traffic_ops_ort.pl
index 7fe99c5..1114963 100755
--- a/traffic_ops/bin/traffic_ops_ort.pl
+++ b/traffic_ops/bin/traffic_ops_ort.pl
@@ -778,12 +778,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);
 }
 

-- 
To stop receiving notification emails like this one, please contact
rob@apache.org.

Mime
View raw message