From a451a618bab129a7685ec04bb25085b2f09a9b63 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 10 May 2024 17:00:22 +0200 Subject: [PATCH] Drop EoL Arista EOS support Puppet doesn't support Arista anymore. --- docs/how_to/hosts/eos.md | 11 ------- lib/beaker/host.rb | 3 -- lib/beaker/host/eos.rb | 33 ------------------- lib/beaker/host/unix/exec.rb | 6 ++-- lib/beaker/host/unix/pkg.rb | 8 ++--- lib/beaker/host_prebuilt_steps.rb | 8 ++--- lib/beaker/perf.rb | 4 +-- lib/beaker/platform.rb | 2 +- spec/beaker/host/eos_spec.rb | 44 ------------------------- spec/beaker/host/unix/file_spec.rb | 14 -------- spec/beaker/host/unix/pkg_spec.rb | 8 ----- spec/beaker/host_prebuilt_steps_spec.rb | 8 ++--- spec/helpers.rb | 4 +-- 13 files changed, 17 insertions(+), 136 deletions(-) delete mode 100644 docs/how_to/hosts/eos.md delete mode 100644 lib/beaker/host/eos.rb delete mode 100644 spec/beaker/host/eos_spec.rb diff --git a/docs/how_to/hosts/eos.md b/docs/how_to/hosts/eos.md deleted file mode 100644 index 56f997b1a..000000000 --- a/docs/how_to/hosts/eos.md +++ /dev/null @@ -1,11 +0,0 @@ -# EOS - Arista - -EOS is the network device OS from Arista. You can get more details from their [product page](https://www.arista.com/en/products/eos). - -It reaches out to the EOS-specific host code for any information that it needs. You can check out [these methods](blob/master/lib/beaker/host/eos.rb) if you need more information about this. - -# Hypervisors - -EOS has only been developed and tested as a [vmpooler](https://github.com/puppetlabs/vmpooler) host. - -This doesn't mean that it can't be used in another hypervisor, but that Beaker doesn't specifically deal with the details of that hypervisor in creating EOS hosts, if there is anything specific to EOS that will need to be done in provisioning steps. diff --git a/lib/beaker/host.rb b/lib/beaker/host.rb index 36d116398..265821d71 100644 --- a/lib/beaker/host.rb +++ b/lib/beaker/host.rb @@ -57,8 +57,6 @@ def self.create name, host_hash, options Mac::Host.new name, host_hash, options when /freebsd/ FreeBSD::Host.new name, host_hash, options - when /eos/ - Eos::Host.new name, host_hash, options when /cisco/ Cisco::Host.new name, host_hash, options else @@ -576,7 +574,6 @@ def add_env_var(key, val) freebsd windows pswindows - eos cisco ].each do |lib| require "beaker/host/#{lib}" diff --git a/lib/beaker/host/eos.rb b/lib/beaker/host/eos.rb deleted file mode 100644 index 1f1e2356b..000000000 --- a/lib/beaker/host/eos.rb +++ /dev/null @@ -1,33 +0,0 @@ -%w[host command_factory].each do |lib| - require "beaker/#{lib}" -end - -module Eos - class Host < Unix::Host - # Copies a remote file to the host location specified - # - # @param [String] remote_url URL to the remote file - # @param [String] host_directory Path to the host directory on the host. - # - # @note in EOS, you just copy the file as an extension, you don't worry - # about location, so that parameter is ignored - # - # @return [Result] The result of copying that file to the host - def get_remote_file(remote_url, _host_directory = '') - commands = ['enable', "copy #{remote_url} extension:"] - command = commands.join("\n") - execute("Cli -c '#{command}'") - end - - # Installs an extension file already copied via {#get_remote_file} or something similar - # - # @param [String] filename Name of the file to install, including file extension - # - # @return [Result] The result of running the install command on the host - def install_from_file(filename) - commands = ['enable', "extension #{filename}"] - command = commands.join("\n") - execute("Cli -c '#{command}'") - end - end -end diff --git a/lib/beaker/host/unix/exec.rb b/lib/beaker/host/unix/exec.rb index 0b40353a4..2182f5ac2 100644 --- a/lib/beaker/host/unix/exec.rb +++ b/lib/beaker/host/unix/exec.rb @@ -280,9 +280,9 @@ def ssh_service_restart case self['platform'] when /debian|ubuntu/ exec(Beaker::Command.new("service ssh restart")) - when /amazon|(el|centos|redhat|oracle|scientific)-[7-9]|eos-7|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/ + when /amazon|(el|centos|redhat|oracle|scientific)-[7-9]|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/ exec(Beaker::Command.new("systemctl restart sshd.service")) - when /el-|centos|fedora|redhat|oracle|scientific|eos/ + when /el-|centos|fedora|redhat|oracle|scientific/ exec(Beaker::Command.new("/sbin/service sshd restart")) when /opensuse|sles/ exec(Beaker::Command.new("/usr/sbin/rcsshd restart")) @@ -302,7 +302,7 @@ def ssh_service_restart # (from {#ssh_service_restart}). def ssh_permit_user_environment case self['platform'] - when /amazon|debian|ubuntu|archlinux|el-|centos|fedora|redhat|oracle|scientific|eos|opensuse|sles|solaris/ + when /amazon|debian|ubuntu|archlinux|el-|centos|fedora|redhat|oracle|scientific|opensuse|sles|solaris/ directory = tmpdir exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit")) exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config")) diff --git a/lib/beaker/host/unix/pkg.rb b/lib/beaker/host/unix/pkg.rb index 9455b6176..cc470d8f5 100644 --- a/lib/beaker/host/unix/pkg.rb +++ b/lib/beaker/host/unix/pkg.rb @@ -37,7 +37,7 @@ def check_for_package(name, opts = {}) self[:sles_rpmkeys_nightly_pl_imported] = true end result = execute("zypper --gpg-auto-import-keys se -i --match-exact #{name}", opts) { |result| result } - when /amazon|cisco|fedora|centos|redhat|eos|el-/ + when /amazon|cisco|fedora|centos|redhat|el-/ result = execute("rpm -q #{name}", opts) { |result| result } when /ubuntu|debian/ result = execute("dpkg -s #{name}", opts) { |result| result } @@ -85,7 +85,7 @@ def install_package(name, cmdline_args = '', version = nil, opts = {}) when /amazon-2023|el-(8|9|1[0-9])|fedora/ name = "#{name}-#{version}" if version execute("dnf -y #{cmdline_args} install #{name}", opts) - when /cisco|centos|redhat|eos|el-[1-7]-/ + when /cisco|centos|redhat|el-[1-7]-/ name = "#{name}-#{version}" if version execute("yum -y #{cmdline_args} install #{name}", opts) when /ubuntu|debian/ @@ -167,7 +167,7 @@ def uninstall_package(name, cmdline_args = '', opts = {}) execute("zypper --non-interactive rm #{name}", opts) when /amazon-2023|el-(8|9|1[0-9])|fedora/ execute("dnf -y #{cmdline_args} remove #{name}", opts) - when /cisco|centos|redhat|eos|el-[1-7]-/ + when /cisco|centos|redhat|el-[1-7]-/ execute("yum -y #{cmdline_args} remove #{name}", opts) when /ubuntu|debian/ execute("apt-get purge #{cmdline_args} -y #{name}", opts) @@ -195,7 +195,7 @@ def upgrade_package(name, cmdline_args = '', opts = {}) execute("zypper --non-interactive --no-gpg-checks up #{name}", opts) when /fedora-(2[2-9]|3[0-9])/ execute("dnf -y #{cmdline_args} update #{name}", opts) - when /cisco|fedora|centos|redhat|eos|el-/ + when /cisco|fedora|centos|redhat|el-/ execute("yum -y #{cmdline_args} update #{name}", opts) when /ubuntu|debian/ update_apt_if_needed diff --git a/lib/beaker/host_prebuilt_steps.rb b/lib/beaker/host_prebuilt_steps.rb index cb4f73655..a26069e2f 100644 --- a/lib/beaker/host_prebuilt_steps.rb +++ b/lib/beaker/host_prebuilt_steps.rb @@ -189,7 +189,7 @@ def sync_root_keys host, opts block_on host do |host| logger.notify "Sync root authorized_keys from github on #{host.name}" # Allow all exit code, as this operation is unlikely to cause problems if it fails. - if /solaris|eos/.match?(host['platform']) + if host['platform'].include?('solaris') host.exec(Command.new(ROOT_KEYS_SYNC_CMD % "bash"), :accept_all_exit_codes => true) elsif host['platform'].include?('aix') host.exec(Command.new(ROOT_KEYS_SYNC_CMD_AIX % "env PATH=/usr/gnu/bin:$PATH bash"), :accept_all_exit_codes => true) @@ -384,7 +384,7 @@ def enable_root_login host, opts host.exec(Command.new("sudo su -c \"service ssh restart\""), { :pty => true }) elsif /amazon|arch|(centos|el|redhat)-[789]|fedora-(1[4-9]|2[0-9]|3[0-9])/.match?(host['platform']) host.exec(Command.new("sudo -E systemctl restart sshd.service"), { :pty => true }) - elsif /centos|el-|redhat|fedora|eos/.match?(host['platform']) + elsif /centos|el-|redhat|fedora/.match?(host['platform']) host.exec(Command.new("sudo -E /sbin/service sshd reload"), { :pty => true }) elsif /(free|open)bsd/.match?(host['platform']) host.exec(Command.new("sudo /etc/rc.d/sshd restart")) @@ -403,7 +403,7 @@ def enable_root_login host, opts def disable_se_linux host, opts logger = opts[:logger] block_on host do |host| - if /centos|el-|redhat|fedora|eos/.match?(host['platform']) + if /centos|el-|redhat|fedora/.match?(host['platform']) logger.debug("Disabling se_linux on #{host.name}") host.exec(Command.new("sudo su -c \"setenforce 0\""), { :pty => true }) else @@ -426,7 +426,7 @@ def package_proxy host, opts case host['platform'] when /ubuntu/, /debian/ host.exec(Command.new("echo 'Acquire::http::Proxy \"#{opts[:package_proxy]}/\";' >> /etc/apt/apt.conf.d/10proxy")) - when /amazon/, /^el-/, /centos/, /fedora/, /redhat/, /eos/ + when /amazon/, /^el-/, /centos/, /fedora/, /redhat/ host.exec(Command.new("echo 'proxy=#{opts[:package_proxy]}/' >> /etc/yum.conf")) when /solaris-11/ host.exec(Command.new("/usr/bin/pkg unset-publisher solaris || :")) diff --git a/lib/beaker/perf.rb b/lib/beaker/perf.rb index ca39b5cf1..081bed08c 100644 --- a/lib/beaker/perf.rb +++ b/lib/beaker/perf.rb @@ -3,8 +3,8 @@ module Beaker class Perf PERF_PACKAGES = ['sysstat'] # SLES does not treat sysstat as a service that can be started - PERF_SUPPORTED_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|opensuse|sles/ - PERF_START_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos/ + PERF_SUPPORTED_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|opensuse|sles/ + PERF_START_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el/ # Create the Perf instance and runs setup_perf_on_host on all hosts if --collect-perf-data # was used as an option on the Baker command line invocation. Instances of this class do not diff --git a/lib/beaker/platform.rb b/lib/beaker/platform.rb index c25c73b52..1bb6a7324 100644 --- a/lib/beaker/platform.rb +++ b/lib/beaker/platform.rb @@ -3,7 +3,7 @@ module Beaker # all String methods while adding several platform-specific use cases. class Platform < String # Supported platforms - PLATFORMS = /^(alpine|amazon|cisco_nexus|cisco_ios_xr|(free|open)bsd|osx|centos|fedora|debian|oracle|redhat|redhatfips|scientific|opensuse|sles|ubuntu|windows|solaris|aix|archlinux|el|eos|netscaler)\-.+\-.+$/ + PLATFORMS = /^(alpine|amazon|cisco_nexus|cisco_ios_xr|(free|open)bsd|osx|centos|fedora|debian|oracle|redhat|redhatfips|scientific|opensuse|sles|ubuntu|windows|solaris|aix|archlinux|el|netscaler)\-.+\-.+$/ # Platform version numbers vs. codenames conversion hash PLATFORM_VERSION_CODES = { :debian => { "forky" => "14", diff --git a/spec/beaker/host/eos_spec.rb b/spec/beaker/host/eos_spec.rb deleted file mode 100644 index d0e62ecd6..000000000 --- a/spec/beaker/host/eos_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'spec_helper' - -module Eos - describe Host do - let(:options) { @options ? @options : {} } - let(:platform) do - if @platform - { :platform => Beaker::Platform.new(@platform) } - else - { :platform => Beaker::Platform.new('eos-vers-arch-extra') } - end - end - let(:host) { make_host('name', options.merge(platform)) } - - describe '#get_remote_file' do - it 'calls enable first' do - expect(host).to receive(:execute).with(/enable/) - host.get_remote_file('remote_url') - end - - it 'begins second line with the copy command' do - expect(host).to receive(:execute).with(/\ncopy/) - host.get_remote_file('remote_url') - end - - it 'ends second line with particular extension location' do - expect(host).to receive(:execute).with(/extension\:\'$/) - host.get_remote_file('remote_url') - end - end - - describe '#install_from_file' do - it 'calls enable first' do - expect(host).to receive(:execute).with(/enable/) - host.install_from_file('local_file') - end - - it 'begins second line with the extension command' do - expect(host).to receive(:execute).with(/\nextension/) - host.install_from_file('local_file') - end - end - end -end diff --git a/spec/beaker/host/unix/file_spec.rb b/spec/beaker/host/unix/file_spec.rb index 8c406b75e..27344ac74 100644 --- a/spec/beaker/host/unix/file_spec.rb +++ b/spec/beaker/host/unix/file_spec.rb @@ -44,13 +44,6 @@ def to_s @platform = 'debian-6-x86_64' expect(instance.repo_type).to be === 'deb' end - - it 'errors for all other platform types' do - @platform = 'eos-4-x86_64' - expect do - instance.repo_type - end.to raise_error(ArgumentError, /repo\ type\ not\ known/) - end end describe '#package_config_dir' do @@ -75,13 +68,6 @@ def to_s @platform = 'opensuse-15-x86_64' expect(instance.package_config_dir).to be === '/etc/zypp/repos.d/' end - - it 'errors for all other platform types' do - @platform = 'eos-4-x86_64' - expect do - instance.package_config_dir - end.to raise_error(ArgumentError, /package\ config\ dir\ unknown/) - end end describe '#repo_filename' do diff --git a/spec/beaker/host/unix/pkg_spec.rb b/spec/beaker/host/unix/pkg_spec.rb index 5bba28cd8..c686772a6 100644 --- a/spec/beaker/host/unix/pkg_spec.rb +++ b/spec/beaker/host/unix/pkg_spec.rb @@ -68,14 +68,6 @@ def exec end end - it "checks correctly on EOS" do - @opts = { 'platform' => 'eos-is-me' } - pkg = 'eos-package' - expect(Beaker::Command).to receive(:new).with("rpm -q #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('') - expect(instance).to receive(:exec).with('', { :accept_all_exit_codes => true }).and_return(generate_result("hello", { :exit_code => 0 })) - expect(instance.check_for_package(pkg)).to be === true - end - it "checks correctly on el-" do @opts = { 'platform' => 'el-is-me' } pkg = 'el_package' diff --git a/spec/beaker/host_prebuilt_steps_spec.rb b/spec/beaker/host_prebuilt_steps_spec.rb index 899a0b3f3..a1e58bceb 100644 --- a/spec/beaker/host_prebuilt_steps_spec.rb +++ b/spec/beaker/host_prebuilt_steps_spec.rb @@ -97,7 +97,7 @@ ] end - ['centos', 'el-', 'redhat', 'fedora', 'eos'].each do |redhat_like| + ['centos', 'el-', 'redhat', 'fedora'].each do |redhat_like| it_behaves_like 'enables_root_login', redhat_like, [ "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"", "sudo -E /sbin/service sshd reload", @@ -268,7 +268,7 @@ context "sync_root_keys" do subject { dummy_class.new } - it "can sync keys on a solaris/eos host" do + it "can sync keys on a solaris host" do @platform = 'solaris' expect(Beaker::Command).to receive(:new).with(sync_cmd % "bash").exactly(3).times @@ -537,10 +537,6 @@ test_host_ssh_calls('ubuntu') end - it "sets user ssh environment on an sshd-based linux host" do - test_host_ssh_calls('eos') - end - it "sets user ssh environment on an sles host" do test_host_ssh_calls('sles') end diff --git a/spec/helpers.rb b/spec/helpers.rb index 2a846bbdf..27f983385 100644 --- a/spec/helpers.rb +++ b/spec/helpers.rb @@ -130,7 +130,6 @@ module PlatformHelpers redhat-7 oracle-7 scientific-7 - eos-7 el-8 centos-8 redhat-8 @@ -143,6 +142,5 @@ module PlatformHelpers 'fedora', 'redhat', 'oracle', - 'scientific', - 'eos',].concat(FEDORASYSTEMV) + 'scientific',].concat(FEDORASYSTEMV) end