Class: PEBuild::Cap::Facts::Solaris
- Defined in:
- lib/pe_build/cap/facts/solaris.rb
Overview
Facts implementation for Solaris guests
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#os_info ⇒ Hash
Returns info about the OS type.
-
#release_info ⇒ Hash
Returns info about the OS version.
Methods inherited from POSIX
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_info ⇒ Hash
Returns info about the OS type
Currently returns family
as Solaris
.
13 14 15 16 17 |
# File 'lib/pe_build/cap/facts/solaris.rb', line 13 def os_info { 'family' => 'Solaris' } end |
#release_info ⇒ Hash
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.
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 |