Class: Specinfra::Helper::DetectOs::Nexus

Inherits:
Specinfra::Helper::DetectOs show all
Defined in:
lib/specinfra/helper/detect_os/nexus.rb

Instance Method Summary collapse

Methods inherited from Specinfra::Helper::DetectOs

detect, #initialize, #run_command

Constructor Details

This class inherits a constructor from Specinfra::Helper::DetectOs

Instance Method Details

#detectObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/specinfra/helper/detect_os/nexus.rb', line 2

def detect
  # CentOS has a os-release file too, but this should do the right thing
  if File.exists?('/etc/os-release')
    contents = {}
    File.read('/etc/os-release').split.collect {|x| x.split('=')}.each {|x| contents[x[0]] = x[1]}
    # This test should only work on a nexus platform in the native OS
    # It will fail in a guest/container shell, which should be picked up elsewhere
    if contents['CISCO_RELEASE_INFO'] && contents['CISCO_RELEASE_INFO'] == "/etc/os-release"
      { :family => 'nexus', :release => contents['VERSION'] }
    end
  end
end