Class: Packer::Provisioner
- Inherits:
-
DataObject
show all
- Defined in:
- lib/packer/provisioner.rb,
lib/packer/provisioners/file.rb,
lib/packer/provisioners/salt.rb,
lib/packer/provisioners/shell.rb,
lib/packer/provisioners/ansible.rb,
lib/packer/provisioners/chef/solo.rb,
lib/packer/provisioners/powershell.rb,
lib/packer/provisioners/chef/client.rb,
lib/packer/provisioners/puppet/server.rb,
lib/packer/provisioners/windows_shell.rb,
lib/packer/provisioners/windows_restart.rb,
lib/packer/provisioners/puppet/masterless.rb
Defined Under Namespace
Classes: Ansible, Chef, File, Powershell, Puppet, Salt, Shell, UnrecognizedProvisionerTypeError, WindowsRestart, WindowsShell
Constant Summary
collapse
- SHELL =
'shell'
- WINDOWS_SHELL =
'windows-shell'
- POWERSHELL =
'powershell'
- FILE =
'file'
- SALT =
'salt-masterless'
- ANSIBLE =
'ansible-local'
- CHEF_CLIENT =
'chef-client'
- CHEF_SOLO =
'chef-solo'
- PUPPET_MASTERLESS =
'puppet-masterless'
- PUPPET_SERVER =
'puppet-server'
- WINDOWS_RESTART =
'windows-restart'
- VALID_PROVISIONER_TYPES =
[
SHELL,
WINDOWS_SHELL,
POWERSHELL,
FILE,
SALT,
ANSIBLE,
CHEF_CLIENT,
CHEF_SOLO,
PUPPET_MASTERLESS,
PUPPET_SERVER,
WINDOWS_RESTART
]
Instance Attribute Summary
Attributes inherited from DataObject
#data, #key_dependencies, #required
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from DataObject
#__add_array_of_array_of_strings, #__add_array_of_hashes, #__add_array_of_ints, #__add_array_of_strings, #__add_boolean, #__add_hash, #__add_integer, #__add_json, #__add_string, #__exclusive_key_error, #add_key_dependencies, #add_required, #deep_copy, #validate, #validate_key_dependencies, #validate_required
Constructor Details
Returns a new instance of Provisioner.
59
60
61
62
|
# File 'lib/packer/provisioner.rb', line 59
def initialize
super
self.add_required('type')
end
|
Class Method Details
.get_provisioner(type) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/packer/provisioner.rb', line 36
def self.get_provisioner(type)
unless validate_type(type)
raise UnrecognizedProvisionerTypeError.new("Unrecognized provisioner type #{type}")
end
{
SHELL => Packer::Provisioner::Shell,
WINDOWS_SHELL => Packer::Provisioner::WindowsShell,
POWERSHELL => Packer::Provisioner::Powershell,
FILE => Packer::Provisioner::File,
SALT => Packer::Provisioner::Salt,
ANSIBLE => Packer::Provisioner::Ansible,
CHEF_CLIENT => Packer::Provisioner::Chef::Client,
CHEF_SOLO => Packer::Provisioner::Chef::Solo,
PUPPET_MASTERLESS => Packer::Provisioner::Puppet::Masterless,
PUPPET_SERVER => Packer::Provisioner::Puppet::Server,
WINDOWS_RESTART => Packer::Provisioner::WindowsRestart
}.fetch(type).new
end
|
Instance Method Details
#except(buildname) ⇒ Object
71
72
73
74
75
76
|
# File 'lib/packer/provisioner.rb', line 71
def except(buildname)
unless self.data.has_key? 'except'
self.data['except'] = []
end
self.data['except'] << buildname.to_s
end
|
#only(buildname) ⇒ Object
64
65
66
67
68
69
|
# File 'lib/packer/provisioner.rb', line 64
def only(buildname)
unless self.data.has_key? 'only'
self.data['only'] = []
end
self.data['only'] << buildname.to_s
end
|
#override(builddefinition, values) ⇒ Object
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/packer/provisioner.rb', line 82
def override(builddefinition, values)
raise TypeError.new() unless values.is_a?(Hash)
unless self.data.has_key? 'override'
self.data['override'] = {}
end
if self.data.has_key? @data['override'][builddefinition]
self.data['override'][builddefinition].merge! values
else
self.data['override'][builddefinition] = values
end
end
|
#pause_before(duration) ⇒ Object
78
79
80
|
# File 'lib/packer/provisioner.rb', line 78
def pause_before(duration)
self.data["pause_before"] = duration.to_s
end
|