Class: Specinfra::Helper::DetectOs::Ios_xr

Inherits:
Specinfra::Helper::DetectOs show all
Defined in:
lib/specinfra/helper/detect_os/ios_xr.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/ios_xr.rb', line 2

def detect
  # CentOS has a os-release file too, but this should do the right thing
  if File.exists?('/etc/cisco-release')
    contents = {}
    File.read('/etc/cisco-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['ID'] == "ios_xr" && contents['ID_LIKE'] && contents['ID_LIKE'].include?('wrlinux')
      { :family => 'ios_xr', :release => contents['VERSION'] }
    end
  end
end