Class: PEBuild::Cap::Facts::Solaris

Inherits:
POSIX
  • Object
show all
Defined in:
lib/pe_build/cap/facts/solaris.rb

Overview

Facts implementation for Solaris guests

Since:

  • 0.13.0

Instance Attribute Summary

Attributes inherited from Base

#machine

Instance Method Summary collapse

Methods inherited from POSIX

#architecture

Methods inherited from Base

#architecture, #basic_facts, #initialize, #load_facts, pebuild_facts, #puppet_path

Constructor Details

This class inherits a constructor from PEBuild::Cap::Facts::Base

Instance Method Details

#os_infoHash

Returns info about the OS type

Currently returns family as Solaris.

Returns:

  • (Hash)

    A hash containing the family of the operating system and, optionally, the name.

See Also:

Since:

  • 0.13.0



13
14
15
16
17
# File 'lib/pe_build/cap/facts/solaris.rb', line 13

def os_info
  {
    'family' => 'Solaris'
  }
end

#release_infoHash

TODO:

Capture full version string. I.E 11.2, 10u11, etc and add minor component.

Returns info about the OS version

Reads /etc/release and generates a full version along with a major component.

Returns:

  • (Hash)

    A hash containing the full version strying of the operating system and, optionally, the minor and major release versions.

See Also:

Since:

  • 0.13.0



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/pe_build/cap/facts/solaris.rb', line 28

def release_info
  release_file = sudo('cat /etc/release')[:stdout]

  # Cribbed from Facter 2.4.
  if match = release_file.match(/\s+s(\d+)[sx]?(_u\d+)?.*(?:SPARC|X86)/)
    version = match.captures.join('')
  elsif match = release_file.match(/Solaris ([0-9\.]+(?:\s*[0-9\.\/]+))\s*(?:SPARC|X86)/)
    version = match.captures.first
  else
    version = sudo('uname -v')[:stdout]
  end

  {
    'major' => version.scan(/\d+/).first,
    'full'  => version
  }
end