Class: PEBuild::Cap::Facts::Ubuntu

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

Overview

Facts implementation for Ubuntu 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

Returns family as Debian and name as Ubuntu.

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
18
# File 'lib/pe_build/cap/facts/ubuntu.rb', line 13

def os_info
  {
    'name'   => 'Ubuntu',
    'family' => 'Debian'
  }
end

#release_infoHash

Returns info about the OS version

Reads /etc/issue and generates a full version.

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



26
27
28
29
30
31
32
33
# File 'lib/pe_build/cap/facts/ubuntu.rb', line 26

def release_info
  release_file = sudo('cat /etc/issue')[:stdout]
  version = release_file.match(/Ubuntu (\d{2}\.\d{2})/)[1]

  {
    'full'  => version
  }
end