Sha256: be9a71cd0ec215af910fe141517f5022beb916d4e7c2e5dac25f558e4d70f0e1

Contents?: true

Size: 1.85 KB

Versions: 6

Compression:

Stored size: 1.85 KB

Contents

module VagrantPlugins
  module PuppetInstall
    class Plugin < Vagrant.plugin('2')
      name 'vagrant-puppet-install'
      description <<-DESC
      This plugin ensures the desired version of Puppet is installed
      via the Puppet Labs package repos.
      DESC

      VAGRANT_VERSION_REQUIREMENT = '>= 1.1.0'.freeze

      # Returns true if the Vagrant version fulfills the requirements
      #
      # @param requirements [String, Array<String>] the version requirement
      # @return [Boolean]
      def self.check_vagrant_version(*requirements)
        Gem::Requirement.new(*requirements).satisfied_by?(
          Gem::Version.new(Vagrant::VERSION))
      end

      # Verifies that the Vagrant version fulfills the requirements
      #
      # @raise [VagrantPlugins::ProxyConf::VagrantVersionError] if this plugin
      # is incompatible with the Vagrant version
      def self.check_vagrant_version!
        unless check_vagrant_version(VAGRANT_VERSION_REQUIREMENT)
          msg = I18n.t(
            'vagrant-puppet_install.errors.vagrant_version',
            requirement: VAGRANT_VERSION_REQUIREMENT.inspect)
          $stderr.puts msg
          raise msg
        end
      end

      action_hook(:install_puppet, Plugin::ALL_ACTIONS) do |hook|
        require_relative 'action/install_puppet'
        hook.after(Vagrant::Action::Builtin::Provision, Action::InstallPuppet)

        # The AWS provider < v0.4.0 uses a non-standard Provision action
        # on initial creation:
        #
        # mitchellh/vagrant-aws/blob/v0.3.0/lib/vagrant-aws/action.rb#L105
        #
        if defined? VagrantPlugins::AWS::Action::TimedProvision
          hook.after(VagrantPlugins::AWS::Action::TimedProvision,
                     Action::InstallPuppet)
        end
      end

      config(:puppet_install) do
        require_relative 'config'
        Config
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-puppet-install-7.0.0 lib/vagrant-puppet-install/plugin.rb
vagrant-puppet-install-6.0.1 lib/vagrant-puppet-install/plugin.rb
vagrant-puppet-install-6.0.0 lib/vagrant-puppet-install/plugin.rb
vagrant-puppet-install-5.0.0 lib/vagrant-puppet-install/plugin.rb
vagrant-puppet-install-4.1.0 lib/vagrant-puppet-install/plugin.rb
vagrant-puppet-install-4.0.1 lib/vagrant-puppet-install/plugin.rb