Class: PEBuild::Config::PEAgent

Inherits:
Object
  • Object
show all
Defined in:
lib/pe_build/config/pe_agent.rb

Overview

Configuration for PE Agent provisioners

Since:

  • 0.13.0

Constant Summary collapse

MINIMUM_VERSION =

The minimum PE Version supported by this provisioner.

Since:

  • 0.13.0

'2015.2.0'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePEAgent

Returns a new instance of PEAgent.

Since:

  • 0.13.0



50
51
52
53
54
55
56
57
# File 'lib/pe_build/config/pe_agent.rb', line 50

def initialize
  @autosign      = UNSET_VALUE
  @autopurge     = UNSET_VALUE
  @master        = UNSET_VALUE
  @master_vm     = UNSET_VALUE
  @version       = UNSET_VALUE
  @agent_type    = UNSET_VALUE
end

Instance Attribute Details

#agent_typeString

This allows for configuring the agent as an infrastructure component. May be either compile, replica, oragent. Defaults toagent`.

Returns:

  • (String)

    The type of agent installation this will be.



48
49
50
# File 'lib/pe_build/config/pe_agent.rb', line 48

def agent_type
  @agent_type
end

#autopurgetrue, false

If true, and #master_vm is set, the agent's certificate and data will be purged from the master VM if the agent is destroyed by Vagrant.

Returns:

  • (true, false)

    Defaults to true if #master_vm is set, otherwise false.



24
25
26
# File 'lib/pe_build/config/pe_agent.rb', line 24

def autopurge
  @autopurge
end

#autosigntrue, false

If true, and #master_vm is set, the agent's certificate will be signed on the master VM.

Returns:

  • (true, false)

    Defaults to true if #master_vm is set, otherwise false.



16
17
18
# File 'lib/pe_build/config/pe_agent.rb', line 16

def autosign
  @autosign
end

#masterString

Returns The DNS hostname of the Puppet master for this node. If #master_vm is set, the hostname of that machine will be used as a default. If the hostname is unset, the name of the VM will be used as a secondary default.

Returns:

  • (String)

    The DNS hostname of the Puppet master for this node. If #master_vm is set, the hostname of that machine will be used as a default. If the hostname is unset, the name of the VM will be used as a secondary default.



31
32
33
# File 'lib/pe_build/config/pe_agent.rb', line 31

def master
  @master
end

#master_vmString

Returns The name of a Vagrant VM to use as the master.

Returns:

  • (String)

    The name of a Vagrant VM to use as the master.



35
36
37
# File 'lib/pe_build/config/pe_agent.rb', line 35

def master_vm
  @master_vm
end

#versionString

string of the form x.y.x[-optional-arbitrary-stuff] or the string current. Defaults to current.

Returns:

  • (String)

    The version of PE to install. May be either a version



41
42
43
# File 'lib/pe_build/config/pe_agent.rb', line 41

def version
  @version
end

Instance Method Details

#finalize!Object

Since:

  • 0.13.0



59
60
61
62
63
64
65
66
# File 'lib/pe_build/config/pe_agent.rb', line 59

def finalize!
  @master        = nil if @master == UNSET_VALUE
  @master_vm     = nil if @master_vm == UNSET_VALUE
  @autosign      = (not @master_vm.nil?) if @autosign  == UNSET_VALUE
  @autopurge     = (not @master_vm.nil?) if @autopurge == UNSET_VALUE
  @version       = 'current' if @version == UNSET_VALUE
  @agent_type    = 'agent' if @agent_type == UNSET_VALUE
end

#validate(machine) ⇒ Object

Since:

  • 0.13.0



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/pe_build/config/pe_agent.rb', line 68

def validate(machine)
  errors = _detected_errors

  if @master.nil? && @master_vm.nil?
    errors << I18n.t('pebuild.config.pe_agent.errors.no_master')
  end

  validate_master_vm!(errors, machine)
  validate_version!(errors, machine)
  validate_agent_type!(errors, machine)

  {'pe_agent provisioner' => errors}
end