Sha256: 7ca1757b3127af7e6aad542f5fe163619c128ff659a78a08dc9923a10a3bc7ee
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
module VagrantPlugins module Omnibus module Action # @author Seth Chisamore <schisamo@opscode.com> # # This action installs Chef Omnibus packages at the desired version. class InstallChef INSTALL_SH = "https://www.opscode.com/chef/install.sh".freeze def initialize(app, env) @app = app # Config#finalize! SHOULD be called automatically env[:global_config].omnibus.finalize! env["omnibus.desired_chef_version"] ||= env[:global_config].omnibus.chef_version end def call(env) desired_chef_version = env["omnibus.desired_chef_version"] unless desired_chef_version.nil? env[:ui].info("Ensuring Chef is installed at requested version of #{desired_chef_version}.") if env[:installed_chef_version] == desired_chef_version env[:ui].info("Chef #{desired_chef_version} Omnibus package is already installed...skipping installation.") else env[:ui].info("Chef #{desired_chef_version} Omnibus package is not installed...installing now.") env[:ssh_run_command] = install_chef_command(desired_chef_version) end end @app.call(env) end private def install_chef_command(version=latest) <<-INSTALL_OMNIBUS if command -v wget &>/dev/null; then wget -qO- #{INSTALL_SH} | sudo bash -s -- -v #{version} elif command -v curl &>/dev/null; then curl -L #{INSTALL_SH} -v #{version} | sudo bash else echo "Neither wget nor curl found. Please install one and try again." >&2 exit 1 fi INSTALL_OMNIBUS end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-omnibus-1.0.0 | lib/vagrant-omnibus/action/install_chef.rb |