Module: Arfor::PlatformInstaller

Defined in:
lib/arfor/platform_installer.rb

Constant Summary collapse

BASE_URL =
"https://pm.puppetlabs.com/cgi-bin/download.cgi?"
BASE_TARGET =
"puppet-enterprise-"
SUFFIX_TARGET =
".tar.gz"
DEFAULT_PE_VERSION =
"latest"
DEFAULT_DIST =
"el"
DEFAULT_REL =
"7"
DEFAULT_ARCH =
"x86_64"

Class Method Summary collapse

Class Method Details

.download(pe_version, dist, rel, arch) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/arfor/platform_installer.rb', line 43

def self.download(pe_version, dist, rel, arch)
  licence_check

  pe_version  = pe_version || DEFAULT_PE_VERSION
  dist        = dist || DEFAULT_DIST
  rel         = rel || DEFAULT_REL
  arch        = arch || DEFAULT_ARCH
  url         = "#{BASE_URL}dist=#{dist}&rel=#{rel}&arch=#{arch}&ver=#{pe_version}"

  Arfor::Download::get(url)
end

.licence_checkObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/arfor/platform_installer.rb', line 30

def self.licence_check
  licenced = false
  if File.exist?(Arfor::LICENCE_FILE)
    licenced = File.foreach(Arfor::LICENCE_FILE).grep(/thanks for registering/)
  end

  if ! licenced
    abort("Missing or invalid ArFour licence detected - email [email protected] to obtain one")
  end
  licenced
end