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.19.2 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.19.1 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.19.0 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.18.2 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.18.1 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.18.0 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.14 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.13 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.12 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.11 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.10 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.9 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.8 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.7 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.6 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.5 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.4 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.3 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.2 lib/pe_build/cap/facts/solaris.rb
vagrant-pe_build-0.17.1 lib/pe_build/cap/facts/solaris.rb