Class: ImageBuilder::Provisioners::Shell

Inherits:
Base
  • Object
show all
Defined in:
lib/image_builder/provisioners/shell.rb

Overview

Generic class doc comment

Constant Summary

Constants included from ImageBuilder

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeShell

Returns a new instance of Shell.



22
23
24
# File 'lib/image_builder/provisioners/shell.rb', line 22

def initialize
  @type = 'shell'
end

Instance Attribute Details

#binaryObject

Optional



13
14
15
# File 'lib/image_builder/provisioners/shell.rb', line 13

def binary
  @binary
end

#environment_varsObject

Returns the value of attribute environment_vars.



14
15
16
# File 'lib/image_builder/provisioners/shell.rb', line 14

def environment_vars
  @environment_vars
end

#execute_commandObject

Returns the value of attribute execute_command.



15
16
17
# File 'lib/image_builder/provisioners/shell.rb', line 15

def execute_command
  @execute_command
end

#inlineObject

Only one of these is allowed/required



8
9
10
# File 'lib/image_builder/provisioners/shell.rb', line 8

def inline
  @inline
end

#inline_shebangObject

Returns the value of attribute inline_shebang.



16
17
18
# File 'lib/image_builder/provisioners/shell.rb', line 16

def inline_shebang
  @inline_shebang
end

#remote_pathObject

Returns the value of attribute remote_path.



17
18
19
# File 'lib/image_builder/provisioners/shell.rb', line 17

def remote_path
  @remote_path
end

#scriptObject

Returns the value of attribute script.



9
10
11
# File 'lib/image_builder/provisioners/shell.rb', line 9

def script
  @script
end

#scriptsObject

Returns the value of attribute scripts.



10
11
12
# File 'lib/image_builder/provisioners/shell.rb', line 10

def scripts
  @scripts
end

#start_retry_timeoutObject

Returns the value of attribute start_retry_timeout.



18
19
20
# File 'lib/image_builder/provisioners/shell.rb', line 18

def start_retry_timeout
  @start_retry_timeout
end

#typeObject (readonly)

Returns the value of attribute type.



20
21
22
# File 'lib/image_builder/provisioners/shell.rb', line 20

def type
  @type
end

Instance Method Details

#packer_hashObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/image_builder/provisioners/shell.rb', line 26

def packer_hash
  hash = { type: @type }

  # Let packer enforce the validation requirements
  # for these attributes, don't make them required
  attr_to_hash(hash, :inline)
  attr_to_hash(hash, :script)
  attr_to_hash(hash, :scripts)

  # Optional attrs
  attr_to_hash(hash, :binary)
  attr_to_hash(hash, :environment_vars)
  attr_to_hash(hash, :execute_command)
  attr_to_hash(hash, :inline_shebang)
  attr_to_hash(hash, :remote_path)
  attr_to_hash(hash, :start_retry_timeout)

  hash
end