Skip to content

Commit

Permalink
Found a bunch of cases that don't have tests. :(
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Davis <zenspider@chef.io>
  • Loading branch information
zenspider committed Jan 23, 2020
1 parent 1a1cb83 commit 827f130
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/train/platforms/detect/specifications/os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def self.load_linux
.detect do
# this checks for the arista bash shell
if unix_file_exist?("/usr/bin/FastCli")
# TODO: no tests
json_cmd('FastCli -p 15 -c "show version | json"')
end
end
Expand All @@ -122,6 +123,7 @@ def self.load_linux
.detect do
lsb = read_linux_lsb
if lsb && lsb[:id] =~ /centos/i
# TODO: no tests
@platform[:release] = lsb[:release]
true
elsif (rel = linux_os_release) && rel["NAME"] =~ /centos/i
Expand All @@ -145,6 +147,7 @@ def self.load_linux
if (raw = unix_file_contents("/etc/parallels-release"))
@platform[:name] = redhatish_platform(raw)
@platform[:release] = raw[/(\d\.\d\.\d)/, 1]
# TODO: no tests
true
end
end
Expand Down Expand Up @@ -198,6 +201,7 @@ def self.load_linux
.detect do
if (raw = unix_file_contents("/etc/alpine-release"))
@platform[:release] = raw.strip
# TODO: no tests
true
end
end
Expand Down Expand Up @@ -244,6 +248,7 @@ def self.load_linux
# happens when logging in as root
plat.family("brocade").title("Brocade Family").in_family("linux")
.detect do
# TODO: no tests
brocade_version
end

Expand All @@ -258,9 +263,11 @@ def self.load_other_unix
plat.name("openvms").title("OpenVMS").in_family("unix")
.detect do
if unix_uname_s =~ /unrecognized command verb/i
# TODO: no tests
cmd = @backend.run_command("show system/noprocess")

if cmd.exit_status == 0 && !cmd.stdout.empty?
# TODO: no tests
@platform[:name] = cmd.stdout.downcase.split(" ")[0]
cmd = @backend.run_command('write sys$output f$getsyi("VERSION")')
@platform[:release] = cmd.stdout.downcase.split("\n")[1][1..-1]
Expand All @@ -280,6 +287,7 @@ def self.load_other_unix
.detect do
out = @backend.run_command("uname -rvp").stdout
if out =~ /(\d+)\s+(\d+)\s+(.*)/
# TODO: no tests
@platform[:release] = "#{$2}.#{$1}"
@platform[:arch] = "#{$3}"
end
Expand All @@ -289,6 +297,8 @@ def self.load_other_unix
plat.family("solaris").in_family("unix")
.detect do
if unix_uname_s =~ /sunos/i
# TODO: no tests

@platform[:release] = $1 if unix_uname_r =~ /^5\.(\d+)$/

arch = @backend.run_command("uname -p")
Expand All @@ -313,11 +323,15 @@ def self.load_other_unix
rel = unix_file_contents("/etc/release")
if rel =~ /Oracle Solaris (\d+)/
@platform[:release] = $1
# TODO: no tests
true
elsif rel =~ /^\s*(Solaris)\s.*$/
# TODO: no tests
true
end

# TODO: no tests

# must be some unknown solaris
true
end
Expand Down Expand Up @@ -410,6 +424,7 @@ def self.load_other

plat.name("vmkernel").in_family("esx")
.detect do
# TODO: no tests
set_from_uname
end

Expand All @@ -436,6 +451,7 @@ def self.load_other
def self.register_bsd(name, title, family, regexp)
plat.name(name).title(title).in_family(family)
.detect do
# TODO: no tests
set_from_uname if unix_uname_s =~ regexp
end
end
Expand All @@ -458,6 +474,7 @@ def self.register_file_content(name, title, family, path)
plat.name(name).title(title).in_family(family)
.detect do
if (raw = unix_file_contents(path))
# TODO: no tests
@platform[:release] = raw.scan(/[\d.]+/).join
true
end
Expand Down Expand Up @@ -497,6 +514,7 @@ def self.register_path(name, title, family, path, regexp)
.detect do
rel = unix_file_contents(path)
if rel =~ regexp
# TODO: no tests
@platform[:release] = $1
true
end
Expand All @@ -519,6 +537,7 @@ def self.register_path_and_uname(name, title, family, path)
def self.register_path_regexp(name, title, family, path, regexp)
plat.name(name).title(title).in_family(family)
.detect do
# TODO: no tests
regexp =~ unix_file_contents(path)
end
end
Expand Down

0 comments on commit 827f130

Please sign in to comment.