Module: Ohai::Mixin::OS

Included in:
DSL::Plugin
Defined in:
lib/ohai/mixin/os.rb

Class Method Summary collapse

Class Method Details

.collect_osString

Using ruby configuration determine the OS we’re running on

Returns:



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ohai/mixin/os.rb', line 29

def collect_os
  case ::RbConfig::CONFIG["host_os"]
  when /aix(.+)$/
    "aix"
  when /darwin(.+)$/
    "darwin"
  when /linux/
    "linux"
  when /freebsd(.+)$/
    "freebsd"
  when /openbsd(.+)$/
    "openbsd"
  when /netbsd(.*)$/
    "netbsd"
  when /dragonfly(.*)$/
    "dragonflybsd"
  when /solaris2/
    "solaris2"
  when /mswin|mingw32|windows/
    # After long discussion in IRC the "powers that be" have come to a consensus
    # that no Windows platform exists that was not based on the
    # Windows_NT kernel, so we herby decree that "windows" will refer to all
    # platforms built upon the Windows_NT kernel and have access to win32 or win64
    # subsystems.
    "windows"
  else
    ::RbConfig::CONFIG["host_os"]
  end
end