Class: Packer::Provisioner::Powershell

Inherits:
Packer::Provisioner show all
Defined in:
lib/packer/provisioners/powershell.rb

Constant Summary

Constants inherited from Packer::Provisioner

ANSIBLE, CHEF_CLIENT, CHEF_SOLO, FILE, POWERSHELL, PUPPET_MASTERLESS, PUPPET_SERVER, SALT, SHELL, VALID_PROVISIONER_TYPES, WINDOWS_RESTART, WINDOWS_SHELL

Instance Attribute Summary

Attributes inherited from DataObject

#data, #key_dependencies, #required

Instance Method Summary collapse

Methods inherited from Packer::Provisioner

#except, get_provisioner, #only, #override, #pause_before, types

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

#initializePowershell

Returns a new instance of Powershell.



8
9
10
11
12
13
14
15
16
# File 'lib/packer/provisioners/powershell.rb', line 8

def initialize
  super
  self.data['type'] = POWERSHELL
  self.add_required(['inline', 'script', 'scripts'])
  self.add_key_dependencies({
      'elevated_user' => ['elevated_password'],
      'elevated_password' => ['elevated_user']
  })
end

Instance Method Details

#binary(bool) ⇒ Object



30
31
32
# File 'lib/packer/provisioners/powershell.rb', line 30

def binary(bool)
  self.__add_boolean('binary', bool, [])
end

#elevated_password(password) ⇒ Object



58
59
60
# File 'lib/packer/provisioners/powershell.rb', line 58

def elevated_password(password)
  self.__add_string('elevated_password', password)
end

#elevated_user(user) ⇒ Object



54
55
56
# File 'lib/packer/provisioners/powershell.rb', line 54

def elevated_user(user)
  self.__add_string('elevated_user', user)
end

#environment_vars(envpairs) ⇒ Object



34
35
36
# File 'lib/packer/provisioners/powershell.rb', line 34

def environment_vars(envpairs)
  self.__add_array_of_strings('environment_vars', envpairs)
end

#execute_command(command) ⇒ Object



38
39
40
# File 'lib/packer/provisioners/powershell.rb', line 38

def execute_command(command)
  self.__add_string('execute_command', command)
end

#inline(commands) ⇒ Object



18
19
20
# File 'lib/packer/provisioners/powershell.rb', line 18

def inline(commands)
  self.__add_array_of_strings('inline', commands, %w[script scripts])
end

#remote_path(command) ⇒ Object



42
43
44
# File 'lib/packer/provisioners/powershell.rb', line 42

def remote_path(command)
  self.__add_string('remote_path', command)
end

#script(filename) ⇒ Object



22
23
24
# File 'lib/packer/provisioners/powershell.rb', line 22

def script(filename)
  self.__add_string('script', filename, %w[inline scripts])
end

#scripts(filenames) ⇒ Object



26
27
28
# File 'lib/packer/provisioners/powershell.rb', line 26

def scripts(filenames)
  self.__add_array_of_strings('scripts', filenames, %w[inline script])
end

#start_retry_timeout(time) ⇒ Object



46
47
48
# File 'lib/packer/provisioners/powershell.rb', line 46

def start_retry_timeout(time)
  self.__add_string('start_retry_timeout', string)
end

#valid_exit_codes(codes) ⇒ Object



50
51
52
# File 'lib/packer/provisioners/powershell.rb', line 50

def valid_exit_codes(codes)
  self.__add_array_of_ints('valid_exit_codes', codes)
end