Class: VagrantPlugins::PuppetInstall::Action::InstallPuppet

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-puppet-install/action/install_puppet.rb

Overview

This action installs Puppet packages at the desired version.

Author:

Constant Summary collapse

APT_PACKAGE_FILE =
"puppetlabs-release-lucid.deb"
APT_PACKAGE_FILE_URL =
"http://apt.puppetlabs.com/#{APT_PACKAGE_FILE}".freeze

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ InstallPuppet

Returns a new instance of InstallPuppet.



29
30
31
32
33
# File 'lib/vagrant-puppet-install/action/install_puppet.rb', line 29

def initialize(app, env)
  @app = app
  # Config#finalize! SHOULD be called automatically
  env[:global_config].puppet_install.finalize!
end

Instance Method Details

#call(env) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vagrant-puppet-install/action/install_puppet.rb', line 35

def call(env)
  desired_puppet_version = env[:global_config].puppet_install.version

  unless desired_puppet_version.nil?
    env[:ui].info("Ensuring Puppet is installed at requested version of #{desired_puppet_version}.")
    if env[:installed_puppet_version] == desired_puppet_version
      env[:ui].info("Puppet #{desired_puppet_version} package is already installed...skipping installation.")
    else
      env[:ui].info("Puppet #{desired_puppet_version} package is not installed...installing now.")
      env[:ssh_run_command] = install_puppet_command(desired_puppet_version)
    end
  end

  @app.call(env)
end