Class: VagrantPlugins::Invade::InvadeModule::Provision::PuppetApply

Inherits:
InvadeModule show all
Defined in:
lib/vagrant-invade/module/provision/puppet_apply/puppet_apply.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InvadeModule

#get_template_path

Constructor Details

#initialize(machine_name, puppet_apply_data, result: nil) ⇒ PuppetApply

Returns a new instance of PuppetApply.



11
12
13
14
15
# File 'lib/vagrant-invade/module/provision/puppet_apply/puppet_apply.rb', line 11

def initialize(machine_name, puppet_apply_data, result: nil)
  @machine_name = machine_name
  @puppet_apply_data = puppet_apply_data
  @result = result
end

Instance Attribute Details

#machine_nameObject

Returns the value of attribute machine_name.



9
10
11
# File 'lib/vagrant-invade/module/provision/puppet_apply/puppet_apply.rb', line 9

def machine_name
  @machine_name
end

#puppet_apply_dataObject

Returns the value of attribute puppet_apply_data.



9
10
11
# File 'lib/vagrant-invade/module/provision/puppet_apply/puppet_apply.rb', line 9

def puppet_apply_data
  @puppet_apply_data
end

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/vagrant-invade/module/provision/puppet_apply/puppet_apply.rb', line 8

def result
  @result
end

Instance Method Details

#buildObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/vagrant-invade/module/provision/puppet_apply/puppet_apply.rb', line 17

def build
  b = binding

  begin

    # Get machine name
    machine_name = @machine_name

    # Values for provider puppet_apply section
    binary_path = @puppet_apply_data['binary_path']
    environment = @puppet_apply_data['environment']
    environment_path = @puppet_apply_data['environment_path']
    options = @puppet_apply_data['options']
    module_path = @puppet_apply_data['module_path']
    manifests_path = @puppet_apply_data['manifests_path']
    manifest_file = @puppet_apply_data['manifest_file']
    hiera_config_path = @puppet_apply_data['hiera_config_path']
    synced_folder_type = @puppet_apply_data['synced_folder_type']
    synced_folder_args = @puppet_apply_data['synced_folder_args']
    temp_dir = @puppet_apply_data['temp_dir']
    working_directory = @puppet_apply_data['working_directory']
    facter = @puppet_apply_data['facter']

    eruby = Erubis::Eruby.new(File.read(self.get_template_path(__FILE__)))
    @result = eruby.result b
  rescue TypeError, SyntaxError, SystemCallError => e
    raise(e)
  end
end