class Packer::Builder

Constants

AMAZON_EBS
AMAZON_INSTANCE
DOCKER
NULL
QEMU
VALID_BUILDER_TYPES
VIRTUALBOX_ISO
VMWARE_ISO
VMWARE_VMX

Attributes

communicators[RW]

Public Class Methods

get_builder(type) click to toggle source
# File lib/packer/builder.rb, line 29
def self.get_builder(type)
  unless validate_type(type)
    raise UnrecognizedBuilderTypeError.new("Unrecognized builder type #{type}")
  end

  {
    AMAZON_EBS      => Packer::Builder::Amazon::EBS,
    AMAZON_INSTANCE => Packer::Builder::Amazon::Instance,
    DOCKER          => Packer::Builder::Docker,
    VIRTUALBOX_ISO  => Packer::Builder::VirtualBoxISO,
    VMWARE_VMX      => Packer::Builder::VMWareVMX,
    VMWARE_ISO      => Packer::Builder::VMWareISO,
    QEMU            => Packer::Builder::Qemu,
    NULL            => Packer::Builder::Null
  }.fetch(type).new
end
new() click to toggle source
Calls superclass method
# File lib/packer/builder.rb, line 52
def initialize
  super
  self.add_required('type')
  self.communicators = []
end
types() click to toggle source
# File lib/packer/builder.rb, line 48
def self.types
  VALID_BUILDER_TYPES
end

Private Class Methods

validate_type(type) click to toggle source
# File lib/packer/builder.rb, line 149
def self.validate_type(type)
  VALID_BUILDER_TYPES.include? type
end

Public Instance Methods

communicator(comm) click to toggle source

@ianchesal: Communicators are technically Templates in Packer land but they modify Builders. Weird. So we'll treat them as Builder attributes. See: packer.io/docs/templates/communicator.html

# File lib/packer/builder.rb, line 65
def communicator(comm)
  raise(DataValidationError, "unknown communicator protocol #{comm}") unless communicators.include? comm

  self.__add_string('communicator', comm)
end
name(name) click to toggle source
# File lib/packer/builder.rb, line 58
def name(name)
  self.__add_string('name', name)
end
ssh_bastion_host(hostname) click to toggle source
# File lib/packer/builder.rb, line 108
def ssh_bastion_host(hostname)
  self.__add_string('ssh_bastion_host', hostname)
end
ssh_bastion_password(password) click to toggle source
# File lib/packer/builder.rb, line 116
def ssh_bastion_password(password)
  self.__add_string('ssh_bastion_password', password)
end
ssh_bastion_private_key_file(filename) click to toggle source
# File lib/packer/builder.rb, line 120
def ssh_bastion_private_key_file(filename)
  self.__add_string('ssh_bastion_private_key_file', filename)
end
ssh_bastion_username(username) click to toggle source
# File lib/packer/builder.rb, line 112
def ssh_bastion_username(username)
  self.__add_string('ssh_bastion_username', username)
end
ssh_disable_agent(disable) click to toggle source
# File lib/packer/builder.rb, line 104
def ssh_disable_agent(disable)
  self.__add_boolean('ssh_disable_agent', disable)
end
ssh_handshake_attempts(attempts) click to toggle source
# File lib/packer/builder.rb, line 100
def ssh_handshake_attempts(attempts)
  self.__add_integer('ssh_handshake_attempts', attempts)
end
ssh_host(host) click to toggle source

Technically these only apply if the communicator is ssh

# File lib/packer/builder.rb, line 72
def ssh_host(host)
  self.__add_string('ssh_host', host)
end
ssh_password(password) click to toggle source
# File lib/packer/builder.rb, line 84
def ssh_password(password)
  self.__add_string('ssh_password', password)
end
ssh_port(port) click to toggle source
# File lib/packer/builder.rb, line 76
def ssh_port(port)
  self.__add_integer('ssh_port', port)
end
ssh_private_key_file(filename) click to toggle source
# File lib/packer/builder.rb, line 88
def ssh_private_key_file(filename)
  self.__add_string('ssh_private_key_file', filename)
end
ssh_pty(pty) click to toggle source
# File lib/packer/builder.rb, line 92
def ssh_pty(pty)
  self.__add_boolean('ssh_pty', pty)
end
ssh_timeout(timeout) click to toggle source
# File lib/packer/builder.rb, line 96
def ssh_timeout(timeout)
  self.__add_string('ssh_timeout', timeout)
end
ssh_username(username) click to toggle source
# File lib/packer/builder.rb, line 80
def ssh_username(username)
  self.__add_string('ssh_username', username)
end
winrm_host(host) click to toggle source

Technically these only apply if the communicator is winrm

# File lib/packer/builder.rb, line 125
def winrm_host(host)
  self.__add_string('winrm_host', host)
end
winrm_password(password) click to toggle source
# File lib/packer/builder.rb, line 137
def winrm_password(password)
  self.__add_string('winrm_password', password)
end
winrm_port(port) click to toggle source
# File lib/packer/builder.rb, line 129
def winrm_port(port)
  self.__add_string('winrm_port', port)
end
winrm_timeout(timeout) click to toggle source
# File lib/packer/builder.rb, line 141
def winrm_timeout(timeout)
  self.__add_string('winrm_timeout', timeout)
end
winrm_username(username) click to toggle source
# File lib/packer/builder.rb, line 133
def winrm_username(username)
  self.__add_string('winrm_username', username)
end