From 96cfe959ab74ef2bbb65d4bebbe1625fbea0d0b0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 10 May 2024 15:36:31 +0200 Subject: [PATCH] Drop EoL huaweios support This isn't a supported platform anymore by puppet. --- lib/beaker/host/unix/exec.rb | 4 ++-- lib/beaker/host/unix/file.rb | 7 +++---- lib/beaker/host/unix/pkg.rb | 10 +++++----- lib/beaker/platform.rb | 3 +-- spec/beaker/host/unix/pkg_spec.rb | 8 -------- spec/helpers.rb | 4 +--- 6 files changed, 12 insertions(+), 24 deletions(-) diff --git a/lib/beaker/host/unix/exec.rb b/lib/beaker/host/unix/exec.rb index 1ce1bf458..0b40353a4 100644 --- a/lib/beaker/host/unix/exec.rb +++ b/lib/beaker/host/unix/exec.rb @@ -278,7 +278,7 @@ def clear_env_var key # @return [Result] result of restarting the SSH service def ssh_service_restart case self['platform'] - when /debian|ubuntu|huaweios/ + 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-/ exec(Beaker::Command.new("systemctl restart sshd.service")) @@ -302,7 +302,7 @@ def ssh_service_restart # (from {#ssh_service_restart}). def ssh_permit_user_environment case self['platform'] - when /amazon|debian|ubuntu|huaweios|archlinux|el-|centos|fedora|redhat|oracle|scientific|eos|opensuse|sles|solaris/ + when /amazon|debian|ubuntu|archlinux|el-|centos|fedora|redhat|oracle|scientific|eos|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/file.rb b/lib/beaker/host/unix/file.rb index 0bf95d8e7..c145adab4 100644 --- a/lib/beaker/host/unix/file.rb +++ b/lib/beaker/host/unix/file.rb @@ -92,7 +92,7 @@ def package_config_dir '/etc/yum.repos.d/' when /opensuse|sles/ '/etc/zypp/repos.d/' - when /debian|ubuntu|huaweios/ + when /debian|ubuntu/ '/etc/apt/sources.list.d' else msg = "package config dir unknown for platform '#{self['platform']}'" @@ -131,8 +131,7 @@ def repo_filename(package_name, build_version) pattern = "%s-%s%s-%s.repo" repo_filename << (format(pattern, variant, fedora_prefix, version, arch)) - when /debian|ubuntu|huaweios/ - codename = variant if variant == 'huaweios' + when /debian|ubuntu/ repo_filename << (format("%s.list", codename)) else msg = "#repo_filename: repo filename pattern not known for platform '#{self['platform']}'" @@ -151,7 +150,7 @@ def repo_type case self['platform'] when /amazon|fedora|el-|redhat|centos|opensuse|sles/ 'rpm' - when /debian|ubuntu|huaweios/ + when /debian|ubuntu/ 'deb' else msg = "#repo_type: repo type not known for platform '#{self['platform']}'" diff --git a/lib/beaker/host/unix/pkg.rb b/lib/beaker/host/unix/pkg.rb index 4b7bd3503..8e4de8c6b 100644 --- a/lib/beaker/host/unix/pkg.rb +++ b/lib/beaker/host/unix/pkg.rb @@ -42,7 +42,7 @@ def check_for_package(name, opts = {}) return false when /amazon|cisco|fedora|centos|redhat|eos|el-/ result = execute("rpm -q #{name}", opts) { |result| result } - when /ubuntu|debian|huaweios/ + when /ubuntu|debian/ result = execute("dpkg -s #{name}", opts) { |result| result } when /solaris-11/ result = execute("pkg info #{name}", opts) { |result| result } @@ -62,7 +62,7 @@ def check_for_package(name, opts = {}) # If apt has not been updated since the last repo deployment it is # updated. Otherwise this is a noop def update_apt_if_needed - return unless /debian|ubuntu|huaweios/.match?(self['platform']) + return unless /debian|ubuntu/.match?(self['platform']) return unless @apt_needs_update execute("apt-get update") @@ -93,7 +93,7 @@ def install_package(name, cmdline_args = '', version = nil, opts = {}) when /cisco|centos|redhat|eos|el-[1-7]-/ name = "#{name}-#{version}" if version execute("yum -y #{cmdline_args} install #{name}", opts) - when /ubuntu|debian|huaweios/ + when /ubuntu|debian/ name = "#{name}=#{version}" if version update_apt_if_needed execute("apt-get install --force-yes #{cmdline_args} -y #{name}", opts) @@ -176,7 +176,7 @@ def uninstall_package(name, cmdline_args = '', opts = {}) execute("dnf -y #{cmdline_args} remove #{name}", opts) when /cisco|centos|redhat|eos|el-[1-7]-/ execute("yum -y #{cmdline_args} remove #{name}", opts) - when /ubuntu|debian|huaweios/ + when /ubuntu|debian/ execute("apt-get purge #{cmdline_args} -y #{name}", opts) when /solaris-11/ execute("pkg #{cmdline_args} uninstall #{name}", opts) @@ -206,7 +206,7 @@ def upgrade_package(name, cmdline_args = '', opts = {}) execute("dnf -y #{cmdline_args} update #{name}", opts) when /cisco|fedora|centos|redhat|eos|el-/ execute("yum -y #{cmdline_args} update #{name}", opts) - when /ubuntu|debian|huaweios/ + when /ubuntu|debian/ update_apt_if_needed execute("apt-get install -o Dpkg::Options::='--force-confold' #{cmdline_args} -y --force-yes #{name}", opts) when /solaris-11/ diff --git a/lib/beaker/platform.rb b/lib/beaker/platform.rb index 4d4388f83..c25c73b52 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|huaweios|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|eos|netscaler)\-.+\-.+$/ # Platform version numbers vs. codenames conversion hash PLATFORM_VERSION_CODES = { :debian => { "forky" => "14", @@ -58,7 +58,6 @@ class Platform < String # provided meets the platform formatting rules. Platforms name must be of # the format /^OSFAMILY-VERSION-ARCH.*$/ where OSFAMILY is one of: # * amazon - # * huaweios # * cisco_nexus # * cisco_ios_xr # * freebsd diff --git a/spec/beaker/host/unix/pkg_spec.rb b/spec/beaker/host/unix/pkg_spec.rb index 8d92a1be9..b33ba9337 100644 --- a/spec/beaker/host/unix/pkg_spec.rb +++ b/spec/beaker/host/unix/pkg_spec.rb @@ -84,14 +84,6 @@ def exec expect(instance.check_for_package(pkg)).to be === true end - it "checks correctly on huaweios" do - @opts = { 'platform' => 'huaweios-is-me' } - pkg = 'debian_package' - expect(Beaker::Command).to receive(:new).with("dpkg -s #{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 debian" do @opts = { 'platform' => 'debian-is-me' } pkg = 'debian_package' diff --git a/spec/helpers.rb b/spec/helpers.rb index faca725e4..2a846bbdf 100644 --- a/spec/helpers.rb +++ b/spec/helpers.rb @@ -120,9 +120,7 @@ def make_instance instance_data = {} end module PlatformHelpers - DEBIANPLATFORMS = %w[debian - ubuntu - huaweios] + DEBIANPLATFORMS = %w[debian ubuntu] FEDORASYSTEMD = (14..39).to_a.collect! { |i| "fedora-#{i}" }