From 23e9248c5ee0fb156b57d60344631ab3216a5811 Mon Sep 17 00:00:00 2001 From: Joe Pappano Date: Thu, 19 Oct 2023 15:20:09 -0400 Subject: [PATCH] t3c remove perl dependency and references (#7829) * removed perl scripts no longer needed * removed references to traffic_ops_ort and supermicro_udev_rules * removed perl dependency * updated CHANGELOG.md * removed if clauses (cherry picked from commit 51345aad56f816ba35be5c090561e5bc524d8aec) --- CHANGELOG.md | 1 + cache-config/build/build_rpm.sh | 2 - .../build/trafficcontrol-cache-config.spec | 5 - cache-config/supermicro_udev_mapper.pl | 81 ---------- cache-config/traffic_ops_ort.pl | 153 ------------------ .../ansible/roles/ats/defaults/main.yml | 14 +- .../ansible/roles/ats/tasks/ats.yml | 24 +-- .../roles/dataset_loader/defaults/main.yml | 6 - .../ansible/roles/grove/tasks/grove.yml | 7 - 9 files changed, 4 insertions(+), 289 deletions(-) delete mode 100755 cache-config/supermicro_udev_mapper.pl delete mode 100755 cache-config/traffic_ops_ort.pl diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa9cb0790..17a9b1f9f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -199,6 +199,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - [#7271](https://github.com/apache/trafficcontrol/pull/7271) Removed `misc/jira_github_issue_import.py`, the project does not use JIRA. - [#7271](https://github.com/apache/trafficcontrol/pull/7271) Removed `traffic_ops/install/bin/convert_profile/`, this script is outdated and is for use on an EOL ATS version. - [#7271](https://github.com/apache/trafficcontrol/pull/7271) Removed `traffic_ops/install/bin/install_go.sh`, `traffic_ops/install/bin/todb_bootstrap.sh` and `traffic_ops/install/bin/install_goose.sh` are no longer in use. +- [#7829](https://github.com/apache/trafficcontrol/pull/7829) Removed `cache-config/supermicro_udev_mapper.pl` and `traffic_ops_ort.pl` and any references ## [7.0.0] - 2022-07-19 ### Added diff --git a/cache-config/build/build_rpm.sh b/cache-config/build/build_rpm.sh index 5aa82fb9a9..9db0ebf203 100755 --- a/cache-config/build/build_rpm.sh +++ b/cache-config/build/build_rpm.sh @@ -127,8 +127,6 @@ initBuildArea() { buildManpage 't3c-preprocess'; ) - cp -p traffic_ops_ort.pl "$dest"; - cp -p supermicro_udev_mapper.pl "$dest"; mkdir -p "${dest}/build"; echo "build_rpm.sh lsing for logrotate"; diff --git a/cache-config/build/trafficcontrol-cache-config.spec b/cache-config/build/trafficcontrol-cache-config.spec index 456b3af9dd..e3176c402e 100644 --- a/cache-config/build/trafficcontrol-cache-config.spec +++ b/cache-config/build/trafficcontrol-cache-config.spec @@ -143,9 +143,6 @@ mkdir -p "${RPM_BUILD_ROOT}"/var/log/trafficcontrol-cache-config mkdir -p ${RPM_BUILD_ROOT}/"$mandir"/"$man1dir" mkdir -p ${RPM_BUILD_ROOT}/usr/lib/systemd/system -cp -p ${RPM_SOURCE_DIR}/trafficcontrol-cache-config-%{version}/traffic_ops_ort.pl ${RPM_BUILD_ROOT}/"$installdir" -cp -p ${RPM_SOURCE_DIR}/trafficcontrol-cache-config-%{version}/supermicro_udev_mapper.pl ${RPM_BUILD_ROOT}/"$installdir" - src=src/github.com/apache/trafficcontrol/cache-config cp -p ${RPM_SOURCE_DIR}/trafficcontrol-cache-config-%{version}/build/atstccfg.logrotate "${RPM_BUILD_ROOT}"/etc/logrotate.d/atstccfg touch ${RPM_BUILD_ROOT}/var/log/trafficcontrol-cache-config/atstccfg.log @@ -225,8 +222,6 @@ fi %files %license LICENSE %attr(755, root, root) -/usr/bin/traffic_ops_ort.pl -/usr/bin/supermicro_udev_mapper.pl /usr/bin/t3c /usr/bin/t3c-apply /usr/bin/t3c-check diff --git a/cache-config/supermicro_udev_mapper.pl b/cache-config/supermicro_udev_mapper.pl deleted file mode 100755 index efaecb51d7..0000000000 --- a/cache-config/supermicro_udev_mapper.pl +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/perl -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use strict; -use warnings; - -$| = 1; - -my $udevadm = "/sbin/udevadm"; -my $kernel_device = shift(@ARGV); - -if (!defined($kernel_device)) { - die("Please specify a device"); -} - -if (! -x $udevadm) { - die("$udevadm: $!"); -} - -# udevadm info --export-db |grep block |grep expander |egrep '^P' -# ... -# P: /devices/pci0000:80/0000:80:01.0/0000:81:00.0/host2/port-2:0/expander-2:0/port-2:0:7/end_device-2:0:7/target2:0:7/2:0:7:0/block/sdbd -# P: /devices/pci0000:80/0000:80:01.0/0000:81:00.0/host2/port-2:0/expander-2:0/port-2:0:8/end_device-2:0:8/target2:0:8/2:0:8:0/block/sdbe -# P: /devices/pci0000:80/0000:80:01.0/0000:81:00.0/host2/port-2:0/expander-2:0/port-2:0:9/end_device-2:0:9/target2:0:9/2:0:9:0/block/sdbf -# ... - -my @out = `/sbin/udevadm info --export-db`; -my $devices = {}; - -for my $line (@out) { - chomp($line); - next unless ($line =~ /^P: .*$/ && $line =~ /block/ && $line =~ /expander/); - - my (undef, $device) = split(/^P: /, $line, 2); - my @path_parts = split(/\//, $device); - my $disk = pop(@path_parts); - pop(@path_parts); - my $path_ids = pop(@path_parts); - my @target_parts = split(/:/, $path_ids); - - $devices->{$target_parts[0]}->{$target_parts[1]}->{$target_parts[2]}->{$target_parts[3]} = $disk; -} - -my $matched = 0; -my $oa = 0; - -for my $da (sort { $a <=> $b } (keys(%{$devices}))) { - my $ob = 0; - for my $db (sort { $a <=> $b } (keys(%{$devices->{$da}}))) { - for my $dc (sort { $a <=> $b } (keys(%{$devices->{$da}->{$db}}))) { - for my $dd (sort { $a <=> $b } (keys(%{$devices->{$da}->{$db}->{$dc}}))) { - if ($kernel_device eq $devices->{$da}->{$db}->{$dc}->{$dd}) { - printf("%d-%d-%02d\n", $oa, $ob, $dc); - $matched = 1; - last; - } - } - - last if ($matched); - } - - last if ($matched); - $ob++; - } - - last if ($matched); - $oa++; -} diff --git a/cache-config/traffic_ops_ort.pl b/cache-config/traffic_ops_ort.pl deleted file mode 100755 index 2c35f6a42e..0000000000 --- a/cache-config/traffic_ops_ort.pl +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/perl -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -use strict; -use warnings; -use Getopt::Long; - -my $dispersion = undef; -my $retries = 5; -my $wait_for_parents = 1; -my $login_dispersion = 0; -my $reval_wait_time = 60; -my $reval_in_use = 0; -my $rev_proxy_disable = 0; -my $skip_os_check = 0; -my $override_hostname_short = ''; -my $to_timeout_ms = 30000; -my $syncds_updates_ipallow = 0; -my $traffic_ops_insecure = 0; -my $via_string_release = 0; -my $dns_local_bind = 0; -my $disable_parent_config_comments = 0; - -print "ERROR traffic_ops_ort.pl is deprecated and will be removed in the next major version! Please upgrade to t3c\n"; - -GetOptions( "dispersion=i" => \$dispersion, # dispersion (in seconds) - "retries=i" => \$retries, - "wait_for_parents=i" => \$wait_for_parents, - "login_dispersion=i" => \$login_dispersion, - "rev_proxy_disable=i" => \$rev_proxy_disable, - "skip_os_check=i" => \$skip_os_check, - "override_hostname_short=s" => \$override_hostname_short, - "to_timeout_ms=i" => \$to_timeout_ms, - "syncds_updates_ipallow=i" => \$syncds_updates_ipallow, - "traffic_ops_insecure=i" => \$traffic_ops_insecure, - "via_string_release=i" => \$via_string_release, - "dns_local_bind=i" => \$dns_local_bind, - "disable_parent_config_comments=i" => \$disable_parent_config_comments, - ); - -my $cmd = 't3c apply -vv'; - -if ( defined $dispersion ) { - my $sleeptime = rand($dispersion); - print "ERROR t3c no longer has a dispersion feature, Please upgrade to t3c, and use shell commands to randomly sleep if necessary. Sleeping for rand($dispersion)=$sleeptime\n"; - sleep($sleeptime); -} -if ( defined $retries ) { - $cmd .= ' --num-retries=' . $retries; -} -if ( defined $wait_for_parents && $wait_for_parents == 0 ) { - $cmd .= ' --wait-for-parents=false'; -} -if ( defined $login_dispersion ) { - my $sleeptime = rand($login_dispersion); - print "ERROR t3c no longer has any dispersion feature, Please upgrade to t3c, and use shell commands to randomly sleep if necessary. Sleeping for rand($login_dispersion)=$sleeptime\n"; - sleep($sleeptime); -} -if ( defined $rev_proxy_disable && $rev_proxy_disable == 1 ) { - $cmd .= ' --rev-proxy-disable=true'; -} -if ( defined $skip_os_check ) { - $cmd .= ' --skip-os-check=' . $skip_os_check; -} -if ( defined $override_hostname_short ) { - $cmd .= ' --cache-host-name=' . $override_hostname_short; -} else { - $cmd .= ' --cache-host-name=' . `hostname -s`; -} -if ( defined $to_timeout_ms ) { - $cmd .= ' --traffic-ops-timeout-milliseconds=' . $to_timeout_ms; -} -if ( $syncds_updates_ipallow == 1 ) { - $cmd .= ' --syncds-updates-ipallow=true'; -} -if ( defined $traffic_ops_insecure ) { - $cmd .= ' --traffic-ops-insecure=' . $traffic_ops_insecure; -} -if ( $via_string_release != 1 ) { - $cmd .= ' --omit-via-string-release=true'; -} -if ( $dns_local_bind == 1 ) { - $cmd .= ' --dns-local-bind=true'; -} -if ( $disable_parent_config_comments == 1 ) { - $cmd .= ' --disable-parent-config-comments=true'; -} - -my $mode = $ARGV[0]; -if ( defined $mode ) { - $cmd .= ' --run-mode=' . $mode; -} -if ( defined( $ARGV[2] ) ) { - my $to_url = $ARGV[2]; - $to_url =~ s/\/*$//g; - $cmd .= ' --traffic-ops-url=' . $to_url; -} -if ( defined( $ARGV[3] ) ) { - my ( $to_user, $to_pass ) = split( /:/, $ARGV[3] ); - $cmd .= ' --traffic-ops-user=' . $to_user; - $cmd .= ' --traffic-ops-password=' . $to_pass; -} -else { - &usage(); - exit 1; -} - -sub usage { - print "====-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-====\n"; - print "Usage: ./traffic_ops_ort.pl [optional flags]\n"; - print "Usage: ./traffic_ops_ort.pl [optional flags]\n"; - print "\t = interactive - asks questions during config process.\n"; - print "\t = report - prints config differences and exits.\n"; - print "\t = badass - attempts to fix all config differences that it can.\n"; - print "\t = syncds - syncs delivery services with what is configured in Traffic Ops.\n"; - print "\t = revalidate - checks for updated revalidations in Traffic Ops and applies them. Requires Traffic Ops 2.1.\n"; - print "\n"; - print "\t => ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, NONE\n"; - print "\n"; - print "\t = URL to Traffic Ops host. Example: https://trafficops.company.net\n"; - print "\n"; - print "\t => Example: 'username:password' \n"; - print "\n\t[optional flags]:\n"; - print "\t dispersion=