Class: ConfigBuilder::Model::Provisioner::Base Abstract

Inherits:
Base
  • Object
show all
Defined in:
lib/config_builder/model/provisioner/base.rb

Overview

This class is abstract.

Abstract base class for Vagrant provisioners

Direct Known Subclasses

File, Puppet, PuppetServer, Shell

Instance Method Summary collapse

Methods inherited from Base

#attr, #attrs=, #call, #configure!, def_model_attribute, def_model_delegator, def_model_id, def_model_option, #eval_models, #instance_id, #instance_options, model_attributes, model_delegators, #model_delegators, model_options, new_from_hash, #with_attr

Instance Method Details

#to_procObject

Since:

  • 0.16.0



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/config_builder/model/provisioner/base.rb', line 14

def to_proc
  Proc.new do |vm_config|
    options = instance_options

    name = options.delete(:name)
    if name.nil?
      name = options.delete(:type)
    elsif Vagrant::VERSION < '1.7'
      # Vagrant 1.6 and earlier used "id" instead of "name".
      options[:id] = name
      name = options.delete(:type)
    end

    vm_config.provision(name, **options) do |config|
      configure!(config)
      eval_models(config)
    end
  end
end