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, #suffix, #version

Instance Method Summary collapse

Constructor Details

#initializePEBootstrap

Returns a new instance of PEBootstrap.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/pe_build/config/pe_bootstrap.rb', line 50

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

  @relocate_manifests = UNSET_VALUE

  @autosign = UNSET_VALUE
end

Instance Attribute Details

#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



45
46
47
# File 'lib/pe_build/config/pe_bootstrap.rb', line 45

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



32
33
34
# File 'lib/pe_build/config/pe_bootstrap.rb', line 32

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



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

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



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

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



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/pe_build/config/pe_bootstrap.rb', line 69

def finalize!

  set_default :@role,        :agent
  set_default :@verbose,     true
  set_default :@master,      'master'
  set_default :@answer_file, nil
  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

end

#validate(machine) ⇒ Object

Parameters:

  • machine (Vagrant::Machine)


90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/pe_build/config/pe_bootstrap.rb', line 90

def validate(machine)
  h = super

  errors = []

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

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