Sha256: 70bd881920f571b827845adf099280598fd3b8ef36f0c488eb76f4fc2fa2fa5f

Contents?: true

Size: 1.93 KB

Versions: 5

Compression:

Stored size: 1.93 KB

Contents

module VagrantPlugins
  module Invade
    module Validator
      module Provision

        class Puppet

          attr_accessor :env
          attr_accessor :puppet

          DEFAULT = {
            'folder' => './puppet',
            'modules' => 'modules',
            'manifests' => 'manifests',
            'manifest_file' => 'init.pp',
            'hiera_config_path' => nil,
            'facter' => []
          }

          def initialize(env, puppet)
            @env = env
            @puppet = Provision.validate_base(env, puppet)
          end

          def validate
            return nil unless @puppet

            # FOLDER
            @puppet['folder'] = Validator.validate_string(
              @puppet['folder'], 'folder', DEFAULT['folder']
            )

            # MODULES PATH
            @puppet['modules_path'] = Validator.validate_string(
              @puppet['modules_path'], 'modules_path', DEFAULT['modules_path']
            )

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

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

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

            # FACTER
            @puppet['facter'] = Validator.validate_array(
              @puppet['facter'], 'facter', DEFAULT['facter']
            )

            @puppet
          end

          def self.default(params)
            @folder = params[:folder]
            @modules_path = params[:modules_path]
            @manifests_path = params[:manifests_path]
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vagrant-invade-0.3.4 lib/vagrant-invade/validator/provision/puppet.rb
vagrant-invade-0.3.3 lib/vagrant-invade/validator/provision/puppet.rb
vagrant-invade-0.3.2 lib/vagrant-invade/validator/provision/puppet.rb
vagrant-invade-0.3.0 lib/vagrant-invade/validator/provision/puppet.rb
vagrant-invade-0.2.0 lib/vagrant-invade/validator/provision/puppet.rb