mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
bugfix: detect os via unames
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
parent
f832001f10
commit
5fec383788
1 changed files with 19 additions and 10 deletions
|
@ -124,7 +124,7 @@ class Vulcano::Plugins::Backend
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def detect_via_uname(uname_s, uname_r)
|
def detect_via_uname
|
||||||
case uname_s.downcase
|
case uname_s.downcase
|
||||||
when /aix/
|
when /aix/
|
||||||
@platform[:family] = 'aix'
|
@platform[:family] = 'aix'
|
||||||
|
@ -188,7 +188,7 @@ class Vulcano::Plugins::Backend
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def detect_linux_via_config(_uname_s, uname_r)
|
def detect_linux_via_config
|
||||||
if !(raw = get_config('oracle-release')).nil?
|
if !(raw = get_config('oracle-release')).nil?
|
||||||
@platform[:family] = 'oracle'
|
@platform[:family] = 'oracle'
|
||||||
@platform[:release] = redhatish_version(raw)
|
@platform[:release] = redhatish_version(raw)
|
||||||
|
@ -277,15 +277,24 @@ class Vulcano::Plugins::Backend
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def detect_other
|
def uname_s
|
||||||
cmd = @backend.run_command('uname -s')
|
@uname_s ||= @backend.run_command('uname -s').stdout
|
||||||
# TODO: print an error in this step of the detection
|
end
|
||||||
return false if cmd.exit_status != 0
|
|
||||||
uname_s = cmd.stdout
|
|
||||||
return false if uname_s.empty?
|
|
||||||
uname_r = @backend.run_command('uname -r').stdout.strip
|
|
||||||
|
|
||||||
return true if detect_linux_via_config(uname_s, uname_r)
|
def uname_r
|
||||||
|
@uname_r ||= (
|
||||||
|
res = @backend.run_command('uname -r').stdout
|
||||||
|
res.strip! unless res.nil?
|
||||||
|
res
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def detect_other
|
||||||
|
# TODO: print an error in this step of the detection
|
||||||
|
return false if uname_s.nil? || uname_s.empty?
|
||||||
|
return false if uname_r.nil? || uname_r.empty?
|
||||||
|
|
||||||
|
return true if detect_linux_via_config
|
||||||
return true if detect_linux_via_lsb
|
return true if detect_linux_via_lsb
|
||||||
# in all other cases we failed the detection
|
# in all other cases we failed the detection
|
||||||
@platform[:family] = 'unknown'
|
@platform[:family] = 'unknown'
|
||||||
|
|
Loading…
Reference in a new issue