Class: PEBuild::Config::PEBootstrap

Inherits:
Global
  • Object
show all
Includes:
PEBuild::ConfigDefault
Defined in:
lib/pe_build/config/pe_bootstrap.rb

Constant Summary collapse

VALID_ROLES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[:agent, :master]
VALID_AUTOSIGN_VALUES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[TrueClass, FalseClass, Array]

Instance Attribute Summary collapse

Attributes inherited from Global

#download_root, #filename, #series, #shared_installer, #suffix, #version, #version_file

Instance Method Summary collapse

Constructor Details

#initializePEBootstrap

Returns a new instance of PEBootstrap.



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/pe_build/config/pe_bootstrap.rb', line 56

def initialize
  super
  @role        = UNSET_VALUE
  @verbose     = UNSET_VALUE
  @master      = UNSET_VALUE
  @answer_file = UNSET_VALUE
  @answer_extras = UNSET_VALUE

  @relocate_manifests = UNSET_VALUE

  @autosign = UNSET_VALUE
end

Instance Attribute Details

#answer_extrasArray<String>

Returns An array of additional answer strings that will be appended to the answer file. (Optional).

Returns:

  • (Array<String>)

    An array of additional answer strings that will be appended to the answer file. (Optional)

Since:

  • 0.11.0



19
20
21
# File 'lib/pe_build/config/pe_bootstrap.rb', line 19

def answer_extras
  @answer_extras
end

#answer_fileString

Returns The path to a user specified answer_file file (Optional).

Returns:

  • (String)

    The path to a user specified answer_file file (Optional)

Since:

  • 0.1.0



13
14
15
# File 'lib/pe_build/config/pe_bootstrap.rb', line 13

def answer_file
  @answer_file
end

#autosignTrueClass, ...

Configure the certificates that will be autosigned by the puppet master.

Returns:

  • (TrueClass)

    All CSRs will be signed

  • (FalseClass)

    The autosign config file will be unmanaged

  • (Array<String>)

    CSRs with the given addresses

See Also:

Since:

  • 0.4.0



51
52
53
# File 'lib/pe_build/config/pe_bootstrap.rb', line 51

def autosign
  @autosign
end

#masterString

Returns The DNS hostname of the Puppet master for this node.

Returns:

  • (String)

    The DNS hostname of the Puppet master for this node.

Since:

  • 0.1.0



8
9
10
# File 'lib/pe_build/config/pe_bootstrap.rb', line 8

def master
  @master
end

#relocate_manifestsTrueClass, FalseClass

Returns if the puppet master should use manifests out of the vagrant directory.

Returns:

  • (TrueClass, FalseClass)

    if the puppet master should use manifests out of the vagrant directory.

Since:

  • 0.1.0



38
39
40
# File 'lib/pe_build/config/pe_bootstrap.rb', line 38

def relocate_manifests
  @relocate_manifests
end

#roleSymbol

Returns The type of the PE installation role. One of [:master, :agent].

Returns:

  • (Symbol)

    The type of the PE installation role. One of [:master, :agent]

Since:

  • 0.1.0



29
30
31
# File 'lib/pe_build/config/pe_bootstrap.rb', line 29

def role
  @role
end

#verboseTrueClass, FalseClass

Returns if stdout will be displayed when installing.

Returns:

  • (TrueClass, FalseClass)

    if stdout will be displayed when installing

Since:

  • 0.1.0



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

def verbose
  @verbose
end

Instance Method Details

#finalize!Object

Note:

This does not finalize values for config options inherited from the global configuration; it's assumed that the late configuration merging in the provisioner will handle that.

Finalize all configuration variables



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/pe_build/config/pe_bootstrap.rb', line 76

def finalize!
  set_default :@role,        nil
  set_default :@verbose,     true
  set_default :@master,      'master'
  set_default :@answer_file, nil
  set_default :@answer_extras, []
  set_default :@autosign,    (@role == :master)

  set_default :@relocate_manifests, false

  # The value of role is normalized to a symbol so that users don't have to
  # know the underlying representation, and we don't have to cast everything
  # to a string and symbols later on.
  #
  # We also need to run this after a default was set, otherwise we'll try to
  # normalize UNSET_VALUE
  @role = @role.intern unless @role.nil?
end

#validate(machine) ⇒ Object

Parameters:

  • machine (Vagrant::Machine)


96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/pe_build/config/pe_bootstrap.rb', line 96

def validate(machine)
  h = super

  errors = []

  validate_role(errors, machine)
  validate_verbose(errors, machine)
  validate_master(errors, machine)
  validate_answer_file(errors, machine)
  validate_answer_extras(errors, machine)
  validate_relocate_manifests(errors, machine)
  validate_autosign(errors, machine)

  errors |= h.values.flatten
  {"PE Bootstrap" => errors}
end