Class: PEBuild::Provisioner::PEAgent

Inherits:
Object
  • Object
show all
Includes:
Util::MachineComms, Util::PEPackaging
Defined in:
lib/pe_build/provisioner/pe_agent.rb

Overview

Provision PE agents using simplified install

Since:

  • 0.13.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util::MachineComms

ensure_reachable, is_reachable?

Methods included from Util::PEPackaging

platform_tag

Instance Attribute Details

#agent_versionObject (readonly)

Since:

  • 0.13.0



18
19
20
# File 'lib/pe_build/provisioner/pe_agent.rb', line 18

def agent_version
  @agent_version
end

#factsObject (readonly)

Since:

  • 0.13.0



17
18
19
# File 'lib/pe_build/provisioner/pe_agent.rb', line 17

def facts
  @facts
end

#master_vmObject (readonly)

Since:

  • 0.13.0



19
20
21
# File 'lib/pe_build/provisioner/pe_agent.rb', line 19

def master_vm
  @master_vm
end

Instance Method Details

#cleanupObject

This gets run during agent destruction and will remove the agent's certificate from the master, if requested.

Since:

  • 0.13.0



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/pe_build/provisioner/pe_agent.rb', line 36

def cleanup
  # Search the list of created VMs, which is a list of [name, provider]
  # tuples. This will fail to match anything if config.master_vm is nil.
  vm_def = machine.env.active_machines.find {|vm| vm[0].to_s == config.master_vm.to_s}
  if vm_def.nil?
    machine.ui.warn I18n.t(
      'pebuild.provisioner.pe_agent.skip_purge_no_master',
      :master => config.master_vm.to_s
    )
    return
  end
  @master_vm = machine.env.machine(*vm_def)

  cleanup_agent_cert if config.autopurge
  cleanup_agent_type unless config.agent_type == 'agent'
end

#provisionObject

Since:

  • 0.13.0



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pe_build/provisioner/pe_agent.rb', line 21

def provision
  provision_init!

  # NOTE: When enabling installation for PE 3.x, Windows isn't supported
  # by that build of pe_repo.
  unless master_vm.nil?
    provision_pe_repo
  end
  provision_agent
  provision_agent_cert if config.autosign
  provision_agent_type unless config.agent_type == 'agent'
end