Class: PEBuild::Cap::DetectInstaller::POSIX Abstract

Inherits:
Base
  • Object
show all
Defined in:
lib/pe_build/cap/detect_installer/posix.rb

Overview

This class is abstract.

Provide an abstract base class for detecting the installer name on POSIX systems.

Direct Known Subclasses

Debian, Redhat, SLES, Solaris, Ubuntu

Instance Method Summary collapse

Methods inherited from Base

detect_installer, #initialize

Constructor Details

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

Instance Method Details

#archObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/pe_build/cap/detect_installer/posix.rb', line 36

def arch
  results = execute_command("uname -m")

  unless results[:retval] == 0
    raise PEBuild::Cap::DetectInstaller::DetectFailed,
      :name  => @machine.name,
      :error => "Could not run 'uname -m' on #{@machine.name}: got #{results[:stderr]}"
  end

  content = results[:stdout]

  content = 'i386' if content.match /i\d86/

  content
end

#detectObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pe_build/cap/detect_installer/posix.rb', line 24

def detect
  dist_version = parse_release_file

  unless supported_releases.include? dist_version
    raise PEBuild::Cap::DetectInstaller::DetectFailed,
      :name  => @machine.name,
      :error => "#{self.class.name} release #{dist_version} not supported"
  end

  "puppet-enterprise-#{@version}-#{name}-#{dist_version}-#{arch}.#{ext}"
end

#extObject



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/pe_build/cap/detect_installer/posix.rb', line 52

def ext
  # Posix release versions of Puppet Enterprise are packaged as .tar.gz
  # files. Pre-release builds are not gzip'd. Select a default extension
  # accordingly. As usual, for exceptional circumstances it's always possible
  # to specify an explicit filename rather than relying on the
  # detect_installer capability.
  if @version =~ /^\d+\.\d+\.\d+$/
    'tar.gz'
  else
    'tar'
  end
end

#nameString

This method is abstract.

Returns The name of the distribution.

Returns:

  • (String)

    The name of the distribution



# File 'lib/pe_build/cap/detect_installer/posix.rb', line 8

#release_fileString

This method is abstract.

Returns The file to use as the release file for the guest.

Returns:

  • (String)

    The file to use as the release file for the guest



# File 'lib/pe_build/cap/detect_installer/posix.rb', line 12

#release_file_formatRegexp

This method is abstract.

Returns A regular expression with one capture that parses the distro version.

Returns:

  • (Regexp)

    A regular expression with one capture that parses the distro version



# File 'lib/pe_build/cap/detect_installer/posix.rb', line 16

#supported_releasesArray<String>

This method is abstract.

Returns All supported releases for the distribution.

Returns:

  • (Array<String>)

    All supported releases for the distribution



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pe_build/cap/detect_installer/posix.rb', line 24

def detect
  dist_version = parse_release_file

  unless supported_releases.include? dist_version
    raise PEBuild::Cap::DetectInstaller::DetectFailed,
      :name  => @machine.name,
      :error => "#{self.class.name} release #{dist_version} not supported"
  end

  "puppet-enterprise-#{@version}-#{name}-#{dist_version}-#{arch}.#{ext}"
end