Class: PackerFiles::Provisioners

Inherits:
Object
  • Object
show all
Defined in:
lib/PackerFiles/Provision/Provisioners.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Provisioners

Constructor just yields self for further initialization

Yields:

  • (_self)

Yield Parameters:



20
21
22
23
# File 'lib/PackerFiles/Provision/Provisioners.rb', line 20

def initialize(&block)
	 @list = []
   yield self if block_given?   
end

Instance Attribute Details

#listObject

List of registered provisioners



17
18
19
# File 'lib/PackerFiles/Provision/Provisioners.rb', line 17

def list
  @list
end

Class Method Details

.doc_fileObject

Documentation for this class



12
13
14
# File 'lib/PackerFiles/Provision/Provisioners.rb', line 12

def self.doc_file
   PackerFiles.DirPath('Provision/example/Provisioners.txt').first
end

Instance Method Details

#ChefSolo(&block) ⇒ Object

Enable Chef Solo Provisioner to be called multiple times with order preservation.



45
46
47
# File 'lib/PackerFiles/Provision/Provisioners.rb', line 45

def ChefSolo(&block)
	 @list.push(Provision::ChefSolo.new(&block))
end

#convert(gen, os) ⇒ Object

Convert self into Packer JSON format.



50
51
52
53
54
55
56
57
58
# File 'lib/PackerFiles/Provision/Provisioners.rb', line 50

def convert(gen, os)
	 @list.unshift(EnableRootLoginScript(os))
	 @list.push(DisableRootLoginScript(os))
   @list.compact.each do |prov|
	    prov.os = os
	    hash    = prov.to_hash(os)
	    gen.provisioners.push(hash) if !hash.nil?
   end
end

#Copy(&block) ⇒ Object

Enable File Copy Provisioner to be called multiple times with order preservation.



27
28
29
# File 'lib/PackerFiles/Provision/Provisioners.rb', line 27

def Copy(&block)
	 @list.push(Provision::Copy.new(&block))
end

#ExternalScript(&block) ⇒ Object

Enable External Script Provisioner to be called multiple times with order preservation.



39
40
41
# File 'lib/PackerFiles/Provision/Provisioners.rb', line 39

def ExternalScript(&block)
	 @list.push(Provision::ExternalScript.new(&block))
end

#InlineScript(&block) ⇒ Object

Enable Inline Script Provisioner to be called multiple times with order preservation.



33
34
35
# File 'lib/PackerFiles/Provision/Provisioners.rb', line 33

def InlineScript(&block)
	 @list.push(Provision::InlineScript.new(&block))
end