Skip to content

Commit

Permalink
Drop EoL huaweios support
Browse files Browse the repository at this point in the history
This isn't a supported platform anymore by puppet.
  • Loading branch information
bastelfreak committed May 10, 2024
1 parent 9a493e9 commit 96cfe95
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 24 deletions.
4 changes: 2 additions & 2 deletions lib/beaker/host/unix/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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"))
Expand Down
7 changes: 3 additions & 4 deletions lib/beaker/host/unix/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']}'"
Expand Down Expand Up @@ -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']}'"
Expand All @@ -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']}'"
Expand Down
10 changes: 5 additions & 5 deletions lib/beaker/host/unix/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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/
Expand Down
3 changes: 1 addition & 2 deletions lib/beaker/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions spec/beaker/host/unix/pkg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 1 addition & 3 deletions spec/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}" }

Expand Down

0 comments on commit 96cfe95

Please sign in to comment.