Sha256: 08a15fa361d7dde864583242dbab87225b1e3c901f839e21a8993b8199d646bb

Contents?: true

Size: 1.12 KB

Versions: 39

Compression:

Stored size: 1.12 KB

Contents

require_relative 'posix'

# Facts implementation for Solaris guests
#
# @since 0.13.0
class PEBuild::Cap::Facts::Solaris < PEBuild::Cap::Facts::POSIX

  # (see PEBuild::Cap::Facts::Base#os_info)
  #
  # Currently returns `family` as `Solaris`.
  #
  # @see PEBuild::Cap::Facts::Base#os_info
  def os_info
    {
      'family' => 'Solaris'
    }
  end

  # (see PEBuild::Cap::Facts::Base#release_info)
  #
  # Reads `/etc/release` and generates a `full` version along with a
  # `major` component.
  #
  # @todo Capture full version string. I.E 11.2, 10u11, etc and add `minor`
  #   component.
  #
  # @see PEBuild::Cap::Facts::Base#release_info
  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

end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
vagrant-pe_build-0.17.0 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.16.0 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.15.6 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.15.5 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.15.4 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.15.3 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.15.1 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.15.0 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.14.2 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.14.1 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.14.0 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.13.7 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.13.6 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.13.5 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.13.4 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.13.3 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.13.2 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.13.1 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.13.0 lib/pe_build/cap/facts/solaris.rb