vagrant-pe_build 0.17.14 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a94374dc836503e946fe00c1f830721f446b901
4
- data.tar.gz: 9f243b38ee63f662a16abb1f8c90995b564ec0ab
3
+ metadata.gz: 722fdb02b3003ab773830539fa6846489578b6c4
4
+ data.tar.gz: 4ced1f298690ee009cb4906440456d29999029f2
5
5
  SHA512:
6
- metadata.gz: ecd35c58357c9d43ec8e953ae6864a23e962cedc5682367b0f92ccec42bc1e2d4f0fa8cbc2ecf42ab2722f6cca2f9844a211ae869e3f16b9d284151385af03ce
7
- data.tar.gz: e791545b660b953b09cc6f98ad90e9c7ccf8649011854a2d9ad9310ea972a53c7b477bf53d48516d6eb0465789d295c0410a25b15362ce9833e5c90c4e38bcdd
6
+ metadata.gz: 21b4e98244a6403adc280d8d5c8b78876850806d77755b10759bc4e1686b32aa17b9f10fea25ca68db251943f4ffd22133de8500f71cf49d122016b5c049eb27
7
+ data.tar.gz: 8b5f65c5f9086276cc805ae97524d7439e9cbf9907766518aaf1515029e0cc87222334a13cc833b795a0ef722d8dcb9e69b71c9d62a984494e4610fdbf6e1dc0
data/.travis.yml CHANGED
@@ -29,6 +29,6 @@ matrix:
29
29
  - rvm: 2.4.4
30
30
  env: TEST_VAGRANT_VERSION=v2.0.4 BUNDLER_VERSION=1.16.1
31
31
  - rvm: 2.4.4
32
- env: TEST_VAGRANT_VERSION=v2.1.2 BUNDLER_VERSION=1.16.1
32
+ env: TEST_VAGRANT_VERSION=v2.1.5 BUNDLER_VERSION=1.16.1
33
33
  - rvm: 2.4.4
34
34
  env: TEST_VAGRANT_VERSION=HEAD BUNDLER_VERSION=1.16.1
data/CHANGELOG CHANGED
@@ -1,6 +1,25 @@
1
1
  vagrant-pe_build
2
2
  ================
3
3
 
4
+ 0.18.0
5
+ ------
6
+
7
+ 2018-10-10
8
+
9
+ This is a backwards compatible feature release.
10
+
11
+ * Add support for signing and purging agent certificates with Puppet 6
12
+ CA commands.
13
+
14
+ * Add support for two new agent types, "replica" and "compile", which can
15
+ be used to provision PE HA replicas and compilers.
16
+
17
+ * Add support for 2019.0.0
18
+
19
+ Huge thanks to Jarret Lavallee for contributing Puppet 6 CA support along
20
+ with the replica and compile agent roles.
21
+
22
+
4
23
  0.17.14
5
24
  -------
6
25
 
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
  require 'rubygems/version'
3
3
 
4
- vagrant_branch = ENV['TEST_VAGRANT_VERSION'] || 'v2.1.2'
4
+ vagrant_branch = ENV['TEST_VAGRANT_VERSION'] || 'v2.1.5'
5
5
  vagrant_version = nil
6
6
 
7
7
  # Wrapping gemspec in the :plugins group causes Vagrant 1.5 and newer to
data/README.markdown CHANGED
@@ -11,6 +11,64 @@ Synopsis
11
11
  `vagrant-pe_build` manages the downloading and installation of Puppet Enterprise
12
12
  on Vagrant boxes to rapidly build a functioning Puppet environment.
13
13
 
14
+ Quickstart
15
+ ---------------
16
+
17
+ Note: This project is part of a larger suite of tools. For an easier
18
+ way to build a PE infrastructure with Vagrant, check out the parent
19
+ project: https://github.com/oscar-stack/oscar
20
+ This documentation should be used when you're using this plugin alone.
21
+
22
+ To use this Vagrant plugin, you must first have a working Vagrant setup.
23
+ The examples below assume you're using Virtualbox for virtualization. If
24
+ you're using another virtualization system, you will have to make
25
+ adjustments to your `Vagrantfile`.
26
+
27
+ Install the plugin by typing: `vagrant plugin install vagrant-pe_build`
28
+
29
+ Next, you'll need to manaually download the version of Puppet
30
+ Enterprise you would like to use. At the time of writing, the latest
31
+ version is 2018.1.3. https://puppet.com/download-puppet-enterprise
32
+ (Make sure to download the version for CentOS 7.)
33
+
34
+ Once that is finished downloading, copy it into a `pe_build` staging
35
+ area (defaults to `~/.vagrant/pe_builds`) by running this command:
36
+ `vagrant pe-build copy puppet-enterprise-2018.1.3-el-7-x86_64.tar.gz`
37
+
38
+ Then create a Vagrantfile that looks like this:
39
+
40
+ ```ruby
41
+ Vagrant.configure('2') do |config|
42
+ config.pe_build.version = '2018.1.3'
43
+
44
+ config.vm.define 'master' do |node|
45
+ node.vm.hostname = 'master.localdomain'
46
+ node.vm.box = 'puppetlabs/centos-7.2-64-nocm'
47
+
48
+ node.vm.provision :pe_bootstrap do |p|
49
+ p.role = :master
50
+ end
51
+ end
52
+
53
+ config.vm.define 'agent' do |node|
54
+ node.vm.box = 'puppetlabs/centos-7.2-64-nocm'
55
+ node.vm.provision "shell", inline: "echo < YOUR MASTER IP > master.localdomain master | sudo tee -a /etc/hosts"
56
+ node.vm.provision :pe_agent do |p|
57
+ p.master_vm = 'master.localdomain'
58
+ end
59
+ end
60
+ end
61
+ ```
62
+
63
+ And then run `vagrant up master` and after PE is installed, you'll
64
+ need to manually discover the master's IP and add it to the Vagrantfile.
65
+
66
+ To do this, type `vagrant ssh master` and then type `ip addr` and copy the
67
+ IP, and paste it into the command for the shell provisioner on the agent.
68
+
69
+ Finally, to create the agent type `vagrant up agent`. This entire process
70
+ is much easier if you use the parent project: https://github.com/oscar-stack/oscar
71
+
14
72
  Vagrantfile Settings
15
73
  -------------------
16
74
 
@@ -132,38 +190,16 @@ with the global `config.pe_build` settings.
132
190
  Currently, agents always receive the `'current'` version installed on the master. Support for setting the version number of agents will be added in a future release. * Options: A version string, `x.y.z[-optional-stuff]`, or the string
133
191
  `'current'`.
134
192
  * Default: `'current'`.
193
+ * `agent_type`
194
+ * Description: The type of agent to provision. This can be set to a agent, compile master, or an HA replica. Some automations are built in to configure the specified agent type on the primary master. Possible values are `'agent'`, `'replica'`, `'compile'`
195
+ * Default: `'agent'`.
135
196
 
136
197
 
137
198
  Commands
138
199
  --------
139
200
 
140
- Usage Example
141
- -------------
142
-
143
- ### Minimal PE 3.x configuration
144
-
145
- This requires that the necessary installers have already been downloaded and
146
- added with `vagrant pe-build copy`.
147
-
148
- ```ruby
149
- Vagrant.configure('2') do |config|
150
- config.pe_build.version = '3.8.4'
151
-
152
- config.vm.define 'master' do |node|
153
- node.vm.box = 'puppetlabs/centos-7.2-64-nocm'
154
-
155
- node.vm.provision :pe_bootstrap do |p|
156
- p.role = :master
157
- end
158
- end
159
-
160
- config.vm.define 'agent1' do |node|
161
- node.vm.box = 'puppetlabs/centos-7.2-64-nocm'
162
- node.vm.provision :pe_bootstrap
163
- end
164
- end
165
- ```
166
-
201
+ Other Usage Examples
202
+ --------------------
167
203
 
168
204
  ### Minimal PE 2015.x configuration
169
205
 
@@ -290,6 +326,3 @@ Contact
290
326
 
291
327
  * [Source code](https://github.com/oscar-stack/vagrant-pe_build)
292
328
  * [Issue tracker](https://github.com/oscar-stack/vagrant-pe_build/issues)
293
-
294
- If you have questions or concerns about this module, contact finch on on
295
- Freenode, or email adrien@puppetlabs.com.
@@ -3,7 +3,7 @@ require 'rubygems/version'
3
3
 
4
4
  # Check for deprecated Vagrant versions
5
5
  class PEBuild::Action::VersionCheck
6
- MINIMUM_VERSION = '1.8.0'
6
+ MINIMUM_VERSION = '2.0.0'
7
7
 
8
8
  def initialize(app, env)
9
9
  @app = app
@@ -40,12 +40,20 @@ class PEBuild::Config::PEAgent < Vagrant.plugin('2', :config)
40
40
  # `current`. Defaults to `current`.
41
41
  attr_accessor :version
42
42
 
43
+ # @!attribute agent_type
44
+ # @return [String] The type of agent installation this will be.
45
+ # This allows for configuring the agent as an infrastructure component.
46
+ # May be either `compile`, `replica, or `agent`.
47
+ # Defaults to `agent`.
48
+ attr_accessor :agent_type
49
+
43
50
  def initialize
44
51
  @autosign = UNSET_VALUE
45
52
  @autopurge = UNSET_VALUE
46
53
  @master = UNSET_VALUE
47
54
  @master_vm = UNSET_VALUE
48
55
  @version = UNSET_VALUE
56
+ @agent_type = UNSET_VALUE
49
57
  end
50
58
 
51
59
  def finalize!
@@ -54,6 +62,7 @@ class PEBuild::Config::PEAgent < Vagrant.plugin('2', :config)
54
62
  @autosign = (not @master_vm.nil?) if @autosign == UNSET_VALUE
55
63
  @autopurge = (not @master_vm.nil?) if @autopurge == UNSET_VALUE
56
64
  @version = 'current' if @version == UNSET_VALUE
65
+ @agent_type = 'agent' if @agent_type == UNSET_VALUE
57
66
  end
58
67
 
59
68
  def validate(machine)
@@ -65,6 +74,7 @@ class PEBuild::Config::PEAgent < Vagrant.plugin('2', :config)
65
74
 
66
75
  validate_master_vm!(errors, machine)
67
76
  validate_version!(errors, machine)
77
+ validate_agent_type!(errors, machine)
68
78
 
69
79
  {'pe_agent provisioner' => errors}
70
80
  end
@@ -120,4 +130,32 @@ class PEBuild::Config::PEAgent < Vagrant.plugin('2', :config)
120
130
  :version_class => @version.class
121
131
  )
122
132
  end
133
+
134
+ def validate_agent_type!(errors, machine)
135
+
136
+ unless ['agent','replica','compile'].include?(@agent_type)
137
+ errors << I18n.t(
138
+ 'pebuild.config.pe_agent.errors.agent_type_invalid',
139
+ :type => @agent_type,
140
+ )
141
+ end
142
+
143
+ if @agent_type == 'replica' and PEBuild::Util::VersionString.compare(@version, '2016.5.0') < 0
144
+ errors << I18n.t(
145
+ 'pebuild.config.pe_agent.errors.agent_type_version_too_old',
146
+ :version => @version,
147
+ :minimum_version => '2016.5.0',
148
+ :agent_type => @agent_type
149
+ )
150
+ elsif @agent_type == 'compile' and PEBuild::Util::VersionString.compare(@version, '2016.1.0') < 0
151
+ errors << I18n.t(
152
+ 'pebuild.config.pe_agent.errors.agent_type_version_too_old',
153
+ :version => @version,
154
+ :minimum_version => '2016.1.0',
155
+ :agent_type => @agent_type
156
+ )
157
+ end
158
+
159
+ return
160
+ end
123
161
  end
@@ -30,6 +30,12 @@ class PEBuild::ConfigBuilder::PEAgent < ::ConfigBuilder::Model::Provisioner::Bas
30
30
  # string of the form `x.y.x[-optional-arbitrary-stuff]` or the string
31
31
  # `current`. Defaults to `current`.
32
32
  def_model_attribute :version
33
+ # @!attribute agent_type
34
+ # @return [String] The type of agent installation this will be.
35
+ # This allows for configuring the agent as an infrastructure component.
36
+ # May be either `compile`, `replica, or `agent`.
37
+ # Defaults to `agent`.
38
+ def_model_attribute :agent_type
33
39
 
34
40
  ::ConfigBuilder::Model::Provisioner.register('pe_agent', self)
35
41
  end
@@ -28,6 +28,7 @@ module PEBuild
28
28
  end
29
29
  provision_agent
30
30
  provision_agent_cert if config.autosign
31
+ provision_agent_type unless config.agent_type == 'agent'
31
32
  end
32
33
 
33
34
  # This gets run during agent destruction and will remove the agent's
@@ -46,6 +47,7 @@ module PEBuild
46
47
  @master_vm = machine.env.machine(*vm_def)
47
48
 
48
49
  cleanup_agent_cert if config.autopurge
50
+ cleanup_agent_type unless config.agent_type == 'agent'
49
51
  end
50
52
 
51
53
  private
@@ -195,7 +197,10 @@ bash pe_frictionless_installer.sh
195
197
  # inverted as `grep -q` will exit with 1 if the certificate is not
196
198
  # found.
197
199
  # TODO: Extend paths to PE 3.x masters.
198
- if not master_vm.communicate.test("/opt/puppetlabs/bin/puppet cert list | grep -q -F #{agent_certname}", :sudo => true)
200
+ csr_check = PEBuild::Util::VersionString.compare(config.version, '2019.0.0') < 0 ?
201
+ "/opt/puppetlabs/bin/puppet cert list | grep -q -F #{agent_certname}" :
202
+ "/opt/puppetlabs/bin/puppetserver ca list | grep -q -F #{agent_certname}"
203
+ if not master_vm.communicate.test(csr_check, :sudo => true)
199
204
  master_vm.ui.info I18n.t(
200
205
  'pebuild.provisioner.pe_agent.no_csr_pending',
201
206
  :certname => agent_certname,
@@ -210,16 +215,13 @@ bash pe_frictionless_installer.sh
210
215
  :master => master_vm.name.to_s
211
216
  )
212
217
 
213
- shell_config = Vagrant.plugin('2').manager.provisioner_configs[:shell].new
214
- shell_config.privileged = true
215
218
  # TODO: Extend paths to PE 3.x masters.
216
- shell_config.inline = <<-EOS
217
- /opt/puppetlabs/bin/puppet cert --allow-dns-alt-names sign #{agent_certname}
218
- EOS
219
- shell_config.finalize!
219
+ # NOTE: 2019.0.0 has Cert SAN allowed by default
220
+ sign_cert = PEBuild::Util::VersionString.compare(config.version, '2019.0.0') < 0 ?
221
+ "/opt/puppetlabs/bin/puppet cert --allow-dns-alt-names sign #{agent_certname}" :
222
+ "/opt/puppetlabs/bin/puppetserver ca sign --certname #{agent_certname}"
223
+ shell_provision_commands(master_vm, sign_cert)
220
224
 
221
- shell_provisioner = Vagrant.plugin('2').manager.provisioners[:shell].new(master_vm, shell_config)
222
- shell_provisioner.provision
223
225
  end
224
226
 
225
227
  def cleanup_agent_cert
@@ -236,7 +238,11 @@ bash pe_frictionless_installer.sh
236
238
  end
237
239
 
238
240
  # TODO: Extend paths to PE 3.x masters.
239
- unless master_vm.communicate.test("/opt/puppetlabs/bin/puppet cert list #{agent_certname}", :sudo => true)
241
+ # TODO: Find a way to query an individual certificate through puppetserver ca.
242
+ cert_check = PEBuild::Util::VersionString.compare(config.version, '2019.0.0') < 0 ?
243
+ "/opt/puppetlabs/bin/puppet cert list #{agent_certname}" :
244
+ "/opt/puppetlabs/bin/puppetserver ca list --all| grep -q -F #{agent_certname}"
245
+ unless master_vm.communicate.test(cert_check, :sudo => true)
240
246
  master_vm.ui.info I18n.t(
241
247
  'pebuild.provisioner.pe_agent.agent_purged',
242
248
  :certname => agent_certname,
@@ -274,6 +280,195 @@ bash pe_frictionless_installer.sh
274
280
  end
275
281
  end
276
282
 
283
+ # Run shell provision commands on a target machine
284
+ # commands is expected to be an array
285
+ def shell_provision_commands(target_machine, commands)
286
+
287
+ shell_config = Vagrant.plugin('2').manager.provisioner_configs[:shell].new
288
+ shell_config.privileged = true
289
+ shell_config.inline = [commands].flatten.join("\n")
290
+ shell_config.finalize!
291
+
292
+ target_machine.ui.info "Running: #{shell_config.inline}"
293
+
294
+ shell_provisioner = Vagrant.plugin('2').manager.provisioners[:shell].new(target_machine, shell_config)
295
+ shell_provisioner.provision
296
+
297
+ end
298
+
299
+ # Run commands on the master_vm based on the agent_type
300
+ # Allows for provisioning replcas and compile masters
301
+ def provision_agent_type
302
+ ensure_reachable(master_vm)
303
+
304
+ agent_certname = facts['certname']
305
+
306
+ # Return if the certname is in the infrastructure status
307
+ if master_vm.communicate.test("/opt/puppetlabs/bin/puppet infrastructure status --host #{agent_certname} --verbose | grep -q -F #{agent_certname}", :sudo => true)
308
+ master_vm.ui.info I18n.t(
309
+ 'pebuild.provisioner.pe_agent.agent_type_provisioned',
310
+ :certname => agent_certname,
311
+ :master => master_vm.name.to_s,
312
+ :type => config.agent_type
313
+ )
314
+ return
315
+ end
316
+
317
+ case config.agent_type
318
+ when 'replica'
319
+ provision_replica
320
+ when 'compile'
321
+ provision_compile
322
+ else
323
+ machine.ui.error I18n.t(
324
+ 'pebuild.provisioner.pe_agent.agent_type_invalid',
325
+ :type => config.agent_type
326
+ )
327
+ return
328
+ end
329
+ end
330
+
331
+ def provision_replica
332
+ # Provision an HA replica
333
+ agent_certname = facts['certname']
334
+
335
+ # Check for code manager and run the puppet agent on the master if it is not running.
336
+ unless master_vm.communicate.test("/opt/puppetlabs/bin/puppet infrastructure status --verbose | grep -q -F 'Code Manager'", :sudo => true)
337
+ shell_provision_commands(master_vm, ['/opt/puppetlabs/bin/puppet agent -t || true', '/opt/puppetlabs/bin/puppet agent -t || true'])
338
+
339
+ # Try to check for code manager again
340
+ unless master_vm.communicate.test("/opt/puppetlabs/bin/puppet infrastructure status --verbose | grep -q -F 'Code Manager'", :sudo => true)
341
+ master_vm.ui.error I18n.t(
342
+ 'pebuild.provisioner.pe_agent.code_manager_not_running',
343
+ :certname => agent_certname,
344
+ :master => master_vm.name.to_s,
345
+ :type => config.agent_type
346
+ )
347
+ return
348
+ end
349
+ end
350
+
351
+ master_vm.ui.info I18n.t(
352
+ 'pebuild.provisioner.pe_agent.provisioning_type',
353
+ :certname => agent_certname,
354
+ :master => master_vm.name.to_s,
355
+ :type => config.agent_type
356
+ )
357
+
358
+ # Run the agent on the machine to ensure it is configured, has a report in puppetdb, and pxp-agent is running
359
+ shell_provision_commands(machine, '/opt/puppetlabs/bin/puppet agent -t || true')
360
+
361
+ # Install an RBAC token
362
+ # Deploy code to ensure it has been done
363
+ # Provision the replica
364
+ shell_provision_commands(master_vm, ['set -e',
365
+ 'echo "puppetlabs" | /opt/puppetlabs/bin/puppet access login --username admin -l 0',
366
+ '/opt/puppetlabs/bin/puppet code deploy --all --wait',
367
+ "/opt/puppetlabs/bin/puppet infrastructure provision replica #{agent_certname}",
368
+ "/opt/puppetlabs/bin/puppet infrastructure enable replica --yes --topology mono #{agent_certname}"
369
+ ])
370
+ end
371
+
372
+ def provision_compile
373
+ # Provision a compile master
374
+ agent_certname = facts['certname']
375
+
376
+ master_vm.ui.info I18n.t(
377
+ 'pebuild.provisioner.pe_agent.provisioning_type',
378
+ :certname => agent_certname,
379
+ :master => master_vm.name.to_s,
380
+ :type => config.agent_type
381
+ )
382
+
383
+ # Pin the node to the PE Master group
384
+ shell_provision_commands(master_vm, ['set -e',
385
+ "CLASSIFIER=$(grep server /etc/puppetlabs/puppet/classifier.yaml | grep -Eo '([^ ]+)$')",
386
+ "CERT_ARGS=\"--cert $(/opt/puppetlabs/bin/puppet config print hostcert)\
387
+ --key $(/opt/puppetlabs/bin/puppet config print hostprivkey)\
388
+ --cacert $(/opt/puppetlabs/bin/puppet config print localcacert)\"",
389
+ "PARSE_ID_RUBY=\"require 'json'; puts JSON.parse(ARGF.read).find{ |group| group['name'] == 'PE Master' }['id']\"",
390
+ "ID=$(curl -sS -k $CERT_ARGS https://$CLASSIFIER:4433/classifier-api/v1/groups |\
391
+ /opt/puppetlabs/puppet/bin/ruby -e \"${PARSE_ID_RUBY}\")",
392
+ "curl -sS -X POST -H 'Content-Type: application/json' $CERT_ARGS \
393
+ https://$CLASSIFIER:4433/classifier-api/v1/groups/$ID/pin?nodes=#{agent_certname}"
394
+ ])
395
+ # Run the agent on the new CM
396
+ shell_provision_commands(machine, '/opt/puppetlabs/bin/puppet agent -t || true')
397
+ # Run the agent on the MoM to update the configuration
398
+ shell_provision_commands(master_vm, '/opt/puppetlabs/bin/puppet agent -t || true')
399
+ end
400
+
401
+ # Remove agent_type configuration from master_vm
402
+ def cleanup_agent_type
403
+ agent_certname = (machine.config.vm.hostname || machine.name).to_s
404
+
405
+ unless is_reachable?(master_vm)
406
+ master_vm.ui.warn I18n.t(
407
+ 'pebuild.provisioner.pe_agent.skip_purge_master_not_reachable',
408
+ :master => master_vm.name.to_s
409
+ )
410
+ return
411
+ end
412
+
413
+ unless master_vm.communicate.test("/opt/puppetlabs/bin/puppet infrastructure status --host #{agent_certname} --verbose | grep -q -F #{agent_certname}", :sudo => true)
414
+ return
415
+ end
416
+
417
+ master_commands = []
418
+ machine_commands = []
419
+ # Setup a shell_provisioner
420
+ case config.agent_type
421
+ when 'replica'
422
+ # Stop the PE services on the replica
423
+ ['puppet', 'pxp-agent' 'pe-puppetserver', 'pe-puppetdb',
424
+ 'pe-orchestration-services', 'pe-console-services', 'pe-postgresql'].each do | service |
425
+ machine_commands.push("/opt/puppetlabs/bin/puppet resource service #{service} ensure=stopped")
426
+ end
427
+
428
+ # Change directories to /tmp to avoid permissions errors with forget command
429
+ # Forget the replica on the master
430
+ master_commands.push('cd /tmp', "/opt/puppetlabs/bin/puppet infrastructure forget #{agent_certname}")
431
+
432
+ when 'compile'
433
+ # Unpin the node from PE Master
434
+ master_commands.push('set -e',
435
+ "CLASSIFIER=$(grep server /etc/puppetlabs/puppet/classifier.yaml | grep -Eo '([^ ]+)$')",
436
+ "CERT_ARGS=\"--cert $(/opt/puppetlabs/bin/puppet config print hostcert)\
437
+ --key $(/opt/puppetlabs/bin/puppet config print hostprivkey) \
438
+ --cacert $(/opt/puppetlabs/bin/puppet config print localcacert)\"",
439
+ "PARSE_ID_RUBY=\"require 'json'; puts JSON.parse(ARGF.read).find{ |group| group['name'] == 'PE Master' }['id']\"",
440
+ "ID=$(curl -sS -k $CERT_ARGS https://$CLASSIFIER:4433/classifier-api/v1/groups | \
441
+ /opt/puppetlabs/puppet/bin/ruby -e \"${PARSE_ID_RUBY}\")",
442
+ "curl -sS -X POST -H 'Content-Type: application/json' $CERT_ARGS \
443
+ https://$CLASSIFIER:4433/classifier-api/v1/groups/$ID/unpin?nodes=#{agent_certname}"
444
+ )
445
+ else
446
+ return
447
+ end
448
+
449
+ master_vm.ui.info I18n.t(
450
+ 'pebuild.provisioner.pe_agent.cleaning_type',
451
+ :certname => agent_certname,
452
+ :master => master_vm.name.to_s,
453
+ :type => config.agent_type
454
+ )
455
+
456
+ # Run the shell provisioner
457
+ begin
458
+ shell_provision_commands(machine, machine_commands)
459
+ shell_provision_commands(master_vm, master_commands)
460
+ rescue Vagrant::Errors::VagrantError => e
461
+ master_vm.ui.error I18n.t(
462
+ 'pebuild.provisioner.pe_agent.type_cleanup_failed',
463
+ :certname => agent_certname,
464
+ :master => master_vm.name.to_s,
465
+ :error_class => e.class,
466
+ :message => e.message,
467
+ :type => config.agent_type
468
+ )
469
+ end
470
+ end
471
+
277
472
  end
278
473
  end
279
474
  end
@@ -47,7 +47,8 @@ module PEBuild
47
47
  require 'pe_build/release/2017_2'
48
48
  require 'pe_build/release/2017_3'
49
49
  require 'pe_build/release/2018_1'
50
+ require 'pe_build/release/2019_0'
50
51
 
51
- LATEST_VERSION = '2018.1.0'
52
+ LATEST_VERSION = '2019.0.0'
52
53
  end
53
54
  end
@@ -0,0 +1,30 @@
1
+ require 'pe_build/release'
2
+
3
+ module PEBuild::Release
4
+ twentynineteen_aught_x = newrelease do
5
+ add_release :el, '5'
6
+ add_release :el, '6'
7
+ add_release :el, '7'
8
+
9
+ add_release :sles, '11'
10
+ add_release :sles, '12'
11
+
12
+ add_release :ubuntu, '14.04'
13
+ add_release :ubuntu, '16.04'
14
+ add_release :ubuntu, '18.04'
15
+
16
+ add_release :windows, '2008'
17
+ add_release :windows, '2008R2'
18
+ add_release :windows, '2012'
19
+ add_release :windows, '2012R2'
20
+ add_release :windows, '2016'
21
+ add_release :windows, '7'
22
+ add_release :windows, '8'
23
+ add_release :windows, '8.1'
24
+ add_release :windows, '10'
25
+
26
+ set_answer_file :master, File.join(PEBuild.template_dir, 'answers', 'master-2016.2.x.conf.erb')
27
+ end
28
+
29
+ @releases['2019.0.0'] = twentynineteen_aught_x
30
+ end
@@ -1,3 +1,3 @@
1
1
  module PEBuild
2
- VERSION = '0.17.14'.freeze
2
+ VERSION = '0.18.0'.freeze
3
3
  end
@@ -162,4 +162,38 @@ describe PEBuild::Config::PEAgent do
162
162
  end
163
163
  end
164
164
 
165
+ describe 'agent_type' do
166
+ it 'defaults to "agent"' do
167
+ subject.finalize!
168
+
169
+ expect(subject.agent_type).to eq 'agent'
170
+ end
171
+
172
+ it 'accepts "replica" as valid' do
173
+ subject.agent_type = 'replica'
174
+ subject.finalize!
175
+
176
+ expect(subject.agent_type).to eq 'replica'
177
+ end
178
+
179
+ it 'fails validation if set wrong' do
180
+ subject.agent_type = 'some-type'
181
+ subject.finalize!
182
+
183
+ errors = subject.validate(machine)
184
+
185
+ expect(errors['pe_agent provisioner'].join).to match(/An invalid agent_type of some-type/)
186
+ end
187
+
188
+ it 'fails validation if using an old PE version' do
189
+ subject.agent_type = 'replica'
190
+ subject.version = '2016.2.0'
191
+ subject.finalize!
192
+
193
+ errors = subject.validate(machine)
194
+
195
+ expect(errors['pe_agent provisioner'].join).to match(/The agent version 2016.2.0 is too old/)
196
+ end
197
+ end
198
+
165
199
  end
@@ -90,6 +90,24 @@ en:
90
90
  %{message}
91
91
 
92
92
  Agent data will have to be removed from %{master} manually.
93
+ agent_type_provisioned: |-
94
+ Agent type already provisioned for %{certname} on %{master}. Skipping %{type} provisioning.
95
+ agent_type_invalid: |-
96
+ An invalid agent_type of %{type} has been specified for the agent. Valid types are
97
+ 'agent', 'compile', and 'replica'.
98
+ provisioning_type: |-
99
+ Provisioning %{certname} as a %{type} on %{master}.
100
+ cleaning_type: |-
101
+ Forgetting %{certname} as a %{type} on %{master}.
102
+ code_manager_not_running: |-
103
+ Code Manager is not running on %{master}, cannot provision %{certname} as type %{type}.
104
+ type_cleanup_failed: |-
105
+ An error of type %{error_class} occurred while unconfiguring %{type}
106
+ agent %{certname} from %{master}:
107
+
108
+ %{message}
109
+
110
+ Any configuration items for %{certname} need to be cleaned up on %{master} manually.
93
111
  transfer:
94
112
  open_uri:
95
113
  download_failed: |-
@@ -144,6 +162,12 @@ en:
144
162
  version_too_old: |-
145
163
  The agent version %{version} is too old; pe_agent can only provision versions
146
164
  newer than %{minimum_version}.
165
+ agent_type_invalid: |-
166
+ An invalid agent_type of %{type} has been specified for the agent. Valid types are
167
+ 'agent', 'compile', and 'replica'.
168
+ agent_type_version_too_old: |-
169
+ The agent version %{version} is too old for agent type %{agent_type}.
170
+ Please use %{minimum_version} or newer.
147
171
  cap:
148
172
  stage_installer:
149
173
  downloading_installer: |-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-pe_build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.14
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-23 00:00:00.000000000 Z
12
+ date: 2018-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-progressbar
@@ -152,6 +152,7 @@ files:
152
152
  - lib/pe_build/release/2017_2.rb
153
153
  - lib/pe_build/release/2017_3.rb
154
154
  - lib/pe_build/release/2018_1.rb
155
+ - lib/pe_build/release/2019_0.rb
155
156
  - lib/pe_build/release/2_0.rb
156
157
  - lib/pe_build/release/2_5.rb
157
158
  - lib/pe_build/release/2_6.rb