trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ocket8...@apache.org
Subject [trafficcontrol] branch master updated: Removing ORT ntpd checks (#5148)
Date Fri, 16 Oct 2020 20:39:35 GMT
This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new bda1a51  Removing ORT ntpd checks (#5148)
bda1a51 is described below

commit bda1a51d708493f7eefc64dabd48ab688f07824f
Author: Steve Malenfant <smalenfant@users.noreply.github.com>
AuthorDate: Fri Oct 16 16:39:20 2020 -0400

    Removing ORT ntpd checks (#5148)
    
    * Commented out checking ntp
    - ntpd is deprecated in Centos 7 and removed in Centos 8
    - Doesn't work when ntpd is using DNS
    
    * Disabled ntpd check
    
    * Removing all references to ntp configuration in the perl version of ORT.
    
    Co-authored-by: Steve Malenfant <steve.malenfant@cox.com>
---
 CHANGELOG.md                       |  1 +
 traffic_ops_ort/traffic_ops_ort.pl | 87 --------------------------------------
 2 files changed, 1 insertion(+), 87 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f357870..59cc89d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 
 ## [unreleased]
 ### Added
+- Traffic Ops Ort: Disabled ntpd verification (ntpd is deprecated in CentOS)
 - Traffic Ops Ort: Adds a transliteration of the traffic_ops_ort.pl perl script to the go
language. See traffic_ops_ort/t3c/README.md.
 - Traffic Ops API v3
 - Added an optional readiness check service to cdn-in-a-box that exits successfully when
it is able to get a `200 OK` from all delivery services
diff --git a/traffic_ops_ort/traffic_ops_ort.pl b/traffic_ops_ort/traffic_ops_ort.pl
index 7aa8579..5677297 100755
--- a/traffic_ops_ort/traffic_ops_ort.pl
+++ b/traffic_ops_ort/traffic_ops_ort.pl
@@ -192,7 +192,6 @@ my @config_files = ();
 #### Process reboot tracker
 my $traffic_ctl_needed           = 0;
 my $sysctl_p_needed              = 0;
-my $ntpd_restart_needed          = 0;
 my $trafficserver_restart_needed = 0;
 
 #### Process installed tracker
@@ -270,8 +269,6 @@ if ( $sysctl_p_needed && $script_mode != $SYNCDS ) {
 	&run_sysctl_p();
 }
 
-&check_ntp();
-
 if ( $script_mode != $REPORT ) {
 	&update_trops();
 }
@@ -1178,10 +1175,6 @@ sub process_config_files{
 				$cfg_file_tracker->{$file}->{'service'} = "puppet";
 				$return = &process_cfg_file($file);
 			}
-			elsif ( $file eq "ntp.conf" ) {
-				$cfg_file_tracker->{$file}->{'service'} = "ntpd";
-				$return = &process_cfg_file($file);
-			}
 			else {
 				( $log_level >> $WARN ) && print "WARN $file is being processed with an
unknown service\n";
 				$cfg_file_tracker->{$file}->{'service'} = "unknown";
@@ -1216,7 +1209,6 @@ sub process_config_files{
 			}
 		}
 	}
-	
 	( $log_level >> $INFO ) && print "\nINFO: ======== End processing config files
========\n\n";
 }
 
@@ -1354,81 +1346,6 @@ sub check_plugins {
 	return $return_code;
 }
 
-sub check_ntp {
-	if ( $ntpd_restart_needed && $script_mode != $SYNCDS ) {
-		if ( $script_mode == $INTERACTIVE ) {
-			my $select = 'Y';
-			( $log_level >> $ERROR ) && print "ERROR ntp configuration has changed.
'service ntpd restart' needs to be run. Should I do that now? (Y/[n]):";
-			$select = <STDIN>;
-			chomp($select);
-			if ( $select =~ m/Y/ ) {
-				my $status = &restart_service("ntpd");
-				( $log_level >> $DEBUG ) && print "DEBUG 'service ntpd restart' run successful.\n";
-			}
-			else {
-				( $log_level >> $ERROR ) && print "ERROR ntp configuration has changed,
but ntpd was not restarted.\n";
-			}
-		}
-		elsif ( $script_mode == $BADASS ) {
-			my $status = &restart_service("ntpd");
-			( $log_level >> $DEBUG ) && print "DEBUG 'service ntpd restart' successful.\n";
-		}
-	}
-	if ( $script_mode == $REPORT ) {
-		open my $fh, '<', "/etc/ntp.conf" || ( ( $log_level >> $ERROR ) && print
"ERROR Can't open /etc/ntp.conf\n" );
-		my %ntp_conf_servers = ();
-		while (<$fh>) {
-			my $line = $_;
-			$line =~ s/\s+/ /g;
-			$line =~ s/(^\s+|\s+$)//g;
-			chomp($line);
-			if ( $line =~ m/^\#/ || $line =~ m/^$/ ) { next; }
-			if ( $line =~ m/^server/ ) {
-				( my $dum, my $server ) = split( /\s+/, $line );
-				( $log_level >> $TRACE ) && print "TRACE ntp.conf server: ...$line...\n";
-				$ntp_conf_servers{$server} = undef;
-			}
-		}
-		close $fh;
-
-		my $ntpq_output         = `/usr/sbin/ntpq -pn`;
-		my $ntp_peer_found      = 0;
-		my $ntp_candidate_found = 0;
-		( my @ntpq_output_lines ) = split( /\n/, $ntpq_output );
-		foreach my $nol (@ntpq_output_lines) {
-			if ( $nol =~ m/refid/ || $nol =~ m/========/ ) { next; }
-			if ( $nol !~ m/(\d){1,3}\.(\d){1,3}\.(\d){1,3}\.(\d){1,3}/ ) { next; }
-			$nol =~ s/^\s//;
-			( $log_level >> $TRACE ) && print "TRACE ntpq output line: ...$nol...\n";
-			( my $ntpq_server ) = split( /\s+/, $nol );
-			if ( $nol =~ m/\*/ ) {
-				( $log_level >> $TRACE ) && print "TRACE Found NTP server peer: $ntpq_server\n";
-				$ntp_peer_found++;
-			}
-			elsif ( $nol =~ m/\+/ ) {
-				( $log_level >> $TRACE ) && print "TRACE Found NTP server candidate: $ntpq_server\n";
-				$ntp_candidate_found++;
-			}
-			$ntpq_server =~ s/^\s//;
-			$ntpq_server =~ s/^\*//;
-			$ntpq_server =~ s/^\-//;
-			$ntpq_server =~ s/^\.//;
-			$ntpq_server =~ s/^\+//;
-			$ntpq_server =~ s/^o//;
-			$ntpq_server =~ s/^x//;
-			( $log_level >> $TRACE ) && print "TRACE ntpq server after processing: $ntpq_server\n";
-
-			if ( !exists( $ntp_conf_servers{$ntpq_server} ) ) {
-				( $log_level >> $ERROR ) && print "ERROR NTP server ($ntpq_server) is in
use but is not configured in ntp.conf!\n";
-			}
-		}
-		if ( !$ntp_peer_found ) {
-			( $log_level >> $ERROR ) && print "ERROR No NTP server peer found!\n";
-		}
-	}
-}
-
-
 my %checked_plugins = ();
 sub check_this_plugin {
 	my $plugin      = shift;
@@ -1537,10 +1454,6 @@ sub process_reload_restarts {
 		( $log_level >> $DEBUG ) && print "DEBUG $cfg_file changed, 'sysctl -p' needed.\n";
 		$sysctl_p_needed++;
 	}
-	elsif ( $cfg_file eq "ntpd.conf" ) {
-		( $log_level >> $DEBUG ) && print "DEBUG $cfg_file changed, ntpd restart
needed.\n";
-		$ntpd_restart_needed++;
-	}
 	elsif ( $cfg_file =~ m/\_facts/ ) {
 		( $log_level >> $DEBUG ) && print "DEBUG Puppet facts file $cfg_file changed.\n";
 		$UPDATE_TROPS_SUCCESSFUL = 1;


Mime
View raw message