Sha256: 8c9c20fbffa9e258c65eef88d78781e013a303275928919aa0ef79001c8763b4

Contents?: true

Size: 1.79 KB

Versions: 12

Compression:

Stored size: 1.79 KB

Contents

require 'rbconfig'

module VagrantPlugins
  module Invade
    module Validator
      module Provision

        # (see: https://docs.vagrantup.com/v2/provisioning/puppet_apply.html)
        class PuppetApply

          attr_accessor :env
          attr_accessor :puppet_apply

          DEFAULT = {
            'module_path' => '.puppet/modules',
            'manifests_path' => './puppet/manifests',
            'manifest_file' => 'init.pp',
            'hiera_config_path' => nil,
            'facter' => {}
          }

          def initialize(env, puppet_apply)
            @env = env
            @puppet_apply = puppet_apply
            @invade = env[:invade]
          end

          def validate
            return nil unless @puppet_apply

            # MODULES PATH
            @puppet_apply['module_path'] = Validator.validate_string_or_array(
              @puppet_apply['module_path'], 'module_path', DEFAULT['module_path']
            )

            # MANIFESTS PATH
            @puppet_apply['manifests_path'] = Validator.validate_string(
              @puppet_apply['manifests_path'], 'manifests_path', DEFAULT['manifests_path']
            )

            # MANIFEST FILE
            @puppet_apply['manifest_file'] = Validator.validate_string(
              @puppet_apply['manifest_file'], 'manifest_file', DEFAULT['manifest_file']
            )

            # HIERA CONFIG PATH
            @puppet_apply['hiera_config_path'] = Validator.validate_string(
              @puppet_apply['hiera_config_path'], 'hiera_config_path', DEFAULT['hiera_config_path']
            )

            # FACTER
            @puppet_apply['facter'] = Validator.validate_hash(
              @puppet_apply['facter'], 'facter', DEFAULT['facter']
            )

            @puppet_apply
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vagrant-invade-0.5.5 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.5.4 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.5.3 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.5.2 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.5.1 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.5.0 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.4.8 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.4.7 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.4.6 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.4.5 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.4.4 lib/vagrant-invade/validator/provision/puppet_apply.rb
vagrant-invade-0.4.3 lib/vagrant-invade/validator/provision/puppet_apply.rb