Skip to content

Commit

Permalink
Drop EoL cisco support
Browse files Browse the repository at this point in the history
Puppet doesnt support cisco anymore since some time.
  • Loading branch information
bastelfreak committed May 10, 2024
1 parent 8603333 commit 3b66311
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 612 deletions.
15 changes: 7 additions & 8 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-05-10 13:25:58 UTC using RuboCop version 1.62.1.
# on 2024-05-10 14:44:46 UTC using RuboCop version 1.62.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -92,14 +92,13 @@ Minitest/RefuteFalse:
- 'acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb'
- 'acceptance/tests/base/host/host_test.rb'

# Offense count: 20
# Offense count: 19
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'Rakefile'
- 'acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb'
- 'lib/beaker/host/cisco.rb'
- 'spec/beaker/host/mac/group_spec.rb'
- 'spec/beaker/host/mac/user_spec.rb'
- 'spec/beaker/host/pswindows/user_spec.rb'
Expand Down Expand Up @@ -144,7 +143,7 @@ RSpec/BeEq:
- 'spec/beaker/subcommand/subcommand_util_spec.rb'
- 'spec/beaker/test_suite_spec.rb'

# Offense count: 121
# Offense count: 113
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Expand All @@ -156,7 +155,7 @@ RSpec/Eq:
Exclude:
- 'spec/beaker/logger_spec.rb'

# Offense count: 240
# Offense count: 232
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 44
Expand Down Expand Up @@ -214,7 +213,7 @@ RSpec/MultipleDescribes:
RSpec/MultipleMemoizedHelpers:
Max: 18

# Offense count: 499
# Offense count: 495
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Expand Down Expand Up @@ -278,7 +277,7 @@ RSpec/SpecFilePathFormat:
- 'spec/beaker/host/windows/user_spec.rb'
- 'spec/beaker/host_prebuilt_steps_spec.rb'

# Offense count: 177
# Offense count: 175
RSpec/SubjectStub:
Exclude:
- 'spec/beaker/dsl/assertions_spec.rb'
Expand Down Expand Up @@ -336,7 +335,7 @@ Security/Open:
Exclude:
- 'lib/beaker/dsl/helpers/web_helpers.rb'

# Offense count: 105
# Offense count: 104
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Expand Down
40 changes: 0 additions & 40 deletions docs/how_to/hosts/cisco.md

This file was deleted.

6 changes: 1 addition & 5 deletions lib/beaker/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ def cmd_line host, cmd = @command, env = @environment, pc = @prepend_cmds, ac =
append_commands = host.append_commands(cmd, ac, :cmd_exe => @cmdexe)

# This will cause things like `puppet -t -v agent` which is maybe bad.
cmd_line_array = if host[:platform]&.include?('cisco_ios_xr')
[prepend_commands, env_string, cmd, options_string, args_string, append_commands]
else
[env_string, prepend_commands, cmd, options_string, args_string, append_commands]
end
cmd_line_array = [env_string, prepend_commands, cmd, options_string, args_string, append_commands]
cmd_line_array.compact.reject(&:empty?).join(' ')
end

Expand Down
3 changes: 0 additions & 3 deletions lib/beaker/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def self.create name, host_hash, options
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
Unix::Host.new name, host_hash, options
end
Expand Down Expand Up @@ -577,7 +575,6 @@ def add_env_var(key, val)
windows
pswindows
eos
cisco
].each do |lib|
require "beaker/host/#{lib}"
end
Expand Down
159 changes: 0 additions & 159 deletions lib/beaker/host/cisco.rb

This file was deleted.

10 changes: 1 addition & 9 deletions lib/beaker/host/unix/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,11 @@ def repo_filename(package_name, build_version)
repo_filename = format("pl-%s-%s-", package_name, build_version)

case variant
when /amazon|fedora|el|redhat|centos|cisco_nexus|cisco_ios_xr|opensuse|sles/
when /amazon|fedora|el|redhat|centos|opensuse|sles/
variant = 'el' if %w[centos redhat].include?(variant)

variant = 'redhatfips' if self['packaging_platform']&.include?('redhatfips')

if variant == 'cisco_nexus'
variant = 'cisco-wrlinux'
version = '5'
end
if variant == 'cisco_ios_xr'
variant = 'cisco-wrlinux'
version = '7'
end
fedora_prefix = (variant == 'fedora' ? 'f' : '')

pattern = "%s-%s%s-%s.repo"
Expand Down
8 changes: 4 additions & 4 deletions lib/beaker/host/unix/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|fedora|centos|redhat|eos|el-/
result = execute("rpm -q #{name}", opts) { |result| result }
when /ubuntu|debian/
result = execute("dpkg -s #{name}", opts) { |result| result }
Expand Down Expand Up @@ -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 /centos|redhat|eos|el-[1-7]-/
name = "#{name}-#{version}" if version
execute("yum -y #{cmdline_args} install #{name}", opts)
when /ubuntu|debian/
Expand Down Expand Up @@ -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 /centos|redhat|eos|el-[1-7]-/
execute("yum -y #{cmdline_args} remove #{name}", opts)
when /ubuntu|debian/
execute("apt-get purge #{cmdline_args} -y #{name}", opts)
Expand Down Expand Up @@ -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 /fedora|centos|redhat|eos|el-/
execute("yum -y #{cmdline_args} update #{name}", opts)
when /ubuntu|debian/
update_apt_if_needed
Expand Down
5 changes: 1 addition & 4 deletions lib/beaker/host_prebuilt_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ def timesync host, opts
ntp_command = "chronyc add server #{ntp_server} prefer trust;chronyc makestep;chronyc burst 1/2"
elsif /opensuse-|sles-/.match?(host['platform'])
ntp_command = "sntp #{ntp_server}"
elsif host['platform'].include?('cisco_nexus')
ntp_server = host.exec(Command.new("getent hosts #{NTPSERVER} | head -n1 |cut -d \" \" -f1"), :acceptable_exit_codes => [0]).stdout
ntp_command = "sudo -E sh -c 'export DCOS_CONTEXT=2;/isan/bin/ntpdate -u -t 20 #{ntp_server}'"
else
ntp_command = "ntpdate -u -t 20 #{ntp_server}"
end
Expand Down Expand Up @@ -137,7 +134,7 @@ def host_packages(host)
when /fedora/
FEDORA_PACKAGES
else
if !/aix|solaris|osx-|netscaler|cisco_/.match?(host['platform'])
if !/aix|solaris|osx-|netscaler/.match?(host['platform'])
UNIX_PACKAGES
else
[]
Expand Down
4 changes: 1 addition & 3 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|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|(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,8 +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
# * cisco_nexus
# * cisco_ios_xr
# * freebsd
# * openbsd
# * osx
Expand Down
Loading

0 comments on commit 3b66311

Please sign in to comment.