vagrant-pe_build 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +9 -0
- data/acceptance/pe_build/pe_bootstrap_3x_spec.rb +33 -0
- data/acceptance/pe_build/pe_bootstrap_latest_spec.rb +35 -0
- data/acceptance/skeletons/pe_build/Vagrantfile +22 -12
- data/lib/pe_build/cap/run_install/posix.rb +3 -1
- data/lib/pe_build/config_builder/global.rb +6 -6
- data/lib/pe_build/config_builder/pe_bootstrap.rb +12 -12
- data/lib/pe_build/provisioner/pe_bootstrap/post_install.rb +32 -8
- data/lib/pe_build/util/version_string.rb +24 -0
- data/lib/pe_build/version.rb +1 -1
- data/spec/shared/helpers/webserver_context.rb +1 -1
- data/tasks/acceptance.rake +6 -6
- metadata +20 -19
- data/acceptance/pe_build/pe_build_spec.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fab41cebad5a61a3fabebcabe67f0110a8722b7a
|
4
|
+
data.tar.gz: f1cf6cb8270f2e4b145eb11d32867f71f135fb5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89518f8d9c34e9b6f8586a31b37bfd2c358056959539e53f727da5b7e8a0c746d0f76305674c062f42121adb4eb4fb0bbf1a59e4c8836e7261a81df20293a66f
|
7
|
+
data.tar.gz: b0f3fab88367f4b524a1dea56ef10e7197d7bd3be812370df8ec2e691728878128b52be239e14b8f88d2a3f123fe57d60bcaf045a4c78b726a0629f158cf4916
|
data/CHANGELOG
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
shared_examples 'provider/provisioner/pe_bootstrap/3x' do |provider, options|
|
2
|
+
if !File.file?(options[:box])
|
3
|
+
raise ArgumentError,
|
4
|
+
"A box file must be downloaded for provider: #{provider}. Try: rake acceptance:setup"
|
5
|
+
end
|
6
|
+
|
7
|
+
include_context 'acceptance'
|
8
|
+
|
9
|
+
let(:extra_env) do
|
10
|
+
vars = options[:env_vars].dup
|
11
|
+
vars['PE_BUILD_DOWNLOAD_ROOT'] = options[:archive_path]
|
12
|
+
|
13
|
+
vars
|
14
|
+
end
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
# The skelton sets up a Vagrantfile which expects the OS under test to be
|
18
|
+
# available as `box`.
|
19
|
+
environment.skeleton('pe_build')
|
20
|
+
assert_execute('vagrant', 'box', 'add', 'box', options[:box])
|
21
|
+
end
|
22
|
+
|
23
|
+
after(:each) do
|
24
|
+
# Ensure any VMs that survived tests are cleaned up.
|
25
|
+
assert_execute('vagrant', 'destroy', '--force', log: false)
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'when installing PE 3.x' do
|
29
|
+
it 'provisions with pe_build' do
|
30
|
+
assert_execute('vagrant', 'up', "--provider=#{provider}", 'pe-3x')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
shared_examples 'provider/provisioner/pe_bootstrap/latest' do |provider, options|
|
2
|
+
if !File.file?(options[:box])
|
3
|
+
raise ArgumentError,
|
4
|
+
"A box file must be downloaded for provider: #{provider}. Try: rake acceptance:setup"
|
5
|
+
end
|
6
|
+
|
7
|
+
include_context 'acceptance'
|
8
|
+
|
9
|
+
let(:webserver_port) { 3838 }
|
10
|
+
let(:webserver_path) { options[:archive_path] }
|
11
|
+
let(:extra_env) do
|
12
|
+
vars = options[:env_vars].dup
|
13
|
+
vars['PE_BUILD_DOWNLOAD_ROOT'] = "http://localhost:#{webserver_port}"
|
14
|
+
|
15
|
+
vars
|
16
|
+
end
|
17
|
+
|
18
|
+
include_context 'webserver'
|
19
|
+
|
20
|
+
before(:each) do
|
21
|
+
environment.skeleton('pe_build')
|
22
|
+
assert_execute('vagrant', 'box', 'add', 'box', options[:box])
|
23
|
+
end
|
24
|
+
|
25
|
+
after(:each) do
|
26
|
+
# Ensure any VMs that survived tests are cleaned up.
|
27
|
+
assert_execute('vagrant', 'destroy', '--force', log: false)
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when installing LATEST from a build server' do
|
31
|
+
it 'provisions with pe_build' do
|
32
|
+
assert_execute('vagrant', 'up', "--provider=#{provider}", 'pe-latest')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,24 +1,34 @@
|
|
1
|
+
def set_resources box, max_ram=512, max_cpu=1
|
2
|
+
box.vm.provider :virtualbox do |vb|
|
3
|
+
vb.customize ["modifyvm", :id, "--cpus", max_cpu]
|
4
|
+
vb.customize ["modifyvm", :id, "--memory", max_ram]
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
1
8
|
Vagrant.configure('2') do |config|
|
2
9
|
config.pe_build.download_root = ENV['PE_BUILD_DOWNLOAD_ROOT']
|
10
|
+
# This is the box name used by the setup helpers in the acceptance tests.
|
3
11
|
config.vm.box = 'box'
|
4
12
|
|
5
|
-
config.vm.define '
|
13
|
+
config.vm.define 'pe-3x' do |node|
|
14
|
+
node.vm.hostname = 'pe-3x.pe-bootstrap.vlan'
|
15
|
+
# All-in-one master nodes need a generous amount of RAM for all the Java.
|
16
|
+
set_resources node, 4096, 1
|
17
|
+
|
6
18
|
node.vm.provision :pe_bootstrap do |p|
|
7
|
-
p.version = '3.
|
8
|
-
p.role = :
|
9
|
-
# Basically the stock answer file with:
|
10
|
-
# q_fail_on_unsuccessful_master_lookup=n
|
11
|
-
p.answer_file = File.join(File.dirname(__FILE__), 'agent-3.x.txt.erb')
|
19
|
+
p.version = '3.8.0'
|
20
|
+
p.role = :master
|
12
21
|
end
|
13
22
|
end
|
14
23
|
|
15
|
-
config.vm.define 'latest
|
24
|
+
config.vm.define 'pe-latest' do |node|
|
25
|
+
node.vm.hostname = 'pe-latest.pe-bootstrap.vlan'
|
26
|
+
# All-in-one master nodes need a generous amount of RAM for all the Java.
|
27
|
+
set_resources node, 4096, 1
|
28
|
+
|
16
29
|
node.vm.provision :pe_bootstrap do |p|
|
17
|
-
p.version_file
|
18
|
-
p.role = :
|
19
|
-
# Basically the stock answer file with:
|
20
|
-
# q_fail_on_unsuccessful_master_lookup=n
|
21
|
-
p.answer_file = File.join(File.dirname(__FILE__), 'agent-3.x.txt.erb')
|
30
|
+
p.version_file = 'LATEST'
|
31
|
+
p.role = :master
|
22
32
|
end
|
23
33
|
end
|
24
34
|
end
|
@@ -5,7 +5,9 @@ class PEBuild::Cap::RunInstall::POSIX
|
|
5
5
|
|
6
6
|
def self.run_install(machine, config, archive)
|
7
7
|
|
8
|
-
|
8
|
+
# NOTE: This test for both the 3.x and 4.x installation locations. Should
|
9
|
+
# probably refactor this into something cleaner.
|
10
|
+
if machine.communicate.test('test -f /opt/puppet/pe_version || test -f /opt/puppetlabs/server/pe_version')
|
9
11
|
machine.ui.warn I18n.t('pebuild.cap.run_install.already_installed'),
|
10
12
|
:name => machine.name
|
11
13
|
return
|
@@ -36,12 +36,12 @@ class PEBuild::ConfigBuilder::Global < ::ConfigBuilder::Model::Base
|
|
36
36
|
|
37
37
|
def to_proc
|
38
38
|
Proc.new do |global_config|
|
39
|
-
global_config.pe_build.download_root =
|
40
|
-
global_config.pe_build.version =
|
41
|
-
global_config.pe_build.version_file =
|
42
|
-
global_config.pe_build.series =
|
43
|
-
global_config.pe_build.suffix =
|
44
|
-
global_config.pe_build.filename =
|
39
|
+
with_attr(:download_root) { |val| global_config.pe_build.download_root = val }
|
40
|
+
with_attr(:version) { |val| global_config.pe_build.version = val }
|
41
|
+
with_attr(:version_file) { |val| global_config.pe_build.version_file = val }
|
42
|
+
with_attr(:series) { |val| global_config.pe_build.series = val }
|
43
|
+
with_attr(:suffix) { |val| global_config.pe_build.suffix = val }
|
44
|
+
with_attr(:filename) { |val| global_config.pe_build.filename = val }
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -44,19 +44,19 @@ class PEBuild::ConfigBuilder::PEBootstrap < ::PEBuild::ConfigBuilder::Global
|
|
44
44
|
Proc.new do |vm_config|
|
45
45
|
vm_config.provision :pe_bootstrap do |pe|
|
46
46
|
# Globally settable attributes
|
47
|
-
pe.download_root =
|
48
|
-
pe.version =
|
49
|
-
pe.version_file =
|
50
|
-
pe.series =
|
51
|
-
pe.suffix =
|
52
|
-
pe.filename =
|
47
|
+
with_attr(:download_root) { |val| pe.download_root = val }
|
48
|
+
with_attr(:version) { |val| pe.version = val }
|
49
|
+
with_attr(:version_file) { |val| pe.version_file = val }
|
50
|
+
with_attr(:series) { |val| pe.series = val }
|
51
|
+
with_attr(:suffix) { |val| pe.suffix = val }
|
52
|
+
with_attr(:filename) { |val| pe.filename = val }
|
53
53
|
|
54
|
-
pe.role =
|
55
|
-
pe.verbose =
|
56
|
-
pe.master =
|
57
|
-
pe.answer_file =
|
58
|
-
pe.relocate_manifests =
|
59
|
-
pe.autosign =
|
54
|
+
with_attr(:role) { |val| pe.role = val }
|
55
|
+
with_attr(:verbose) { |val| pe.verbose = val }
|
56
|
+
with_attr(:master) { |val| pe.master = val }
|
57
|
+
with_attr(:answer_file) { |val| pe.answer_file = val }
|
58
|
+
with_attr(:relocate_manifests) { |val| pe.relocate_manifests = val }
|
59
|
+
with_attr(:autosign) { |val| pe.autosign = val }
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pe_build/on_machine'
|
2
|
+
require 'pe_build/util/version_string'
|
2
3
|
|
3
4
|
class PEBuild::Provisioner::PEBootstrap::PostInstall
|
4
5
|
|
@@ -17,14 +18,23 @@ class PEBuild::Provisioner::PEBootstrap::PostInstall
|
|
17
18
|
|
18
19
|
resources = []
|
19
20
|
|
21
|
+
if PEBuild::Util::VersionString.compare(@config.version, '3.7.0') < 0 then
|
22
|
+
resources << gen_httpd
|
23
|
+
else
|
24
|
+
resources << gen_puppetserver
|
25
|
+
end
|
20
26
|
resources << gen_relocate if @config.relocate_manifests
|
21
27
|
resources << gen_autosign if @config.autosign
|
22
|
-
resources << gen_service
|
23
28
|
|
24
29
|
manifest = resources.join("\n\n")
|
25
30
|
write_manifest(manifest)
|
26
31
|
|
27
|
-
|
32
|
+
if PEBuild::Util::VersionString.compare(@config.version, '4.0.0') < 0 then
|
33
|
+
puppet_apply = "/opt/puppet/bin/puppet apply"
|
34
|
+
else
|
35
|
+
puppet_apply = "/opt/puppetlabs/bin/puppet apply"
|
36
|
+
end
|
37
|
+
|
28
38
|
manifest_path = "/vagrant/.pe_build/post-install/#{@machine.name}.pp"
|
29
39
|
|
30
40
|
on_machine(@machine, "#{puppet_apply} #{manifest_path}")
|
@@ -46,14 +56,14 @@ class PEBuild::Provisioner::PEBootstrap::PostInstall
|
|
46
56
|
manifest = <<-MANIFEST.gsub(/^\s{6}/, '')
|
47
57
|
augeas { 'move_manifestdir':
|
48
58
|
changes => 'set etc/puppetlabs/puppet/puppet.conf/main/manifestdir /manifests',
|
49
|
-
notify => Service[
|
59
|
+
notify => Service[$pe_master_service],
|
50
60
|
}
|
51
61
|
|
52
62
|
# Update puppet.conf to add the modulepath directive to point to the
|
53
63
|
# /module mount, if it hasn't already been set.
|
54
64
|
augeas { 'move_modulepath':
|
55
65
|
changes => 'set etc/puppetlabs/puppet/puppet.conf/main/modulepath /modules',
|
56
|
-
notify => Service[
|
66
|
+
notify => Service[$pe_master_service],
|
57
67
|
}
|
58
68
|
|
59
69
|
# Rewrite the olde site.pp config since it's not used, and warn people
|
@@ -62,7 +72,7 @@ class PEBuild::Provisioner::PEBootstrap::PostInstall
|
|
62
72
|
ensure => file,
|
63
73
|
path => '/etc/puppetlabs/puppet/manifests/site.pp',
|
64
74
|
content => '# /etc/puppetlabs/puppet/manifests is not used; see /manifests.',
|
65
|
-
notify => Service[
|
75
|
+
notify => Service[$pe_master_service],
|
66
76
|
}
|
67
77
|
MANIFEST
|
68
78
|
|
@@ -89,16 +99,30 @@ class PEBuild::Provisioner::PEBootstrap::PostInstall
|
|
89
99
|
owner => 'root',
|
90
100
|
group => 'pe-puppet',
|
91
101
|
mode => '0644',
|
92
|
-
notify => Service[
|
102
|
+
notify => Service[$pe_master_service],
|
93
103
|
}
|
94
104
|
MANIFEST
|
95
105
|
|
96
106
|
manifest
|
97
107
|
end
|
98
108
|
|
99
|
-
def
|
109
|
+
def gen_httpd
|
100
110
|
manifest = <<-MANIFEST.gsub(/^\s{6}/, '')
|
101
|
-
|
111
|
+
$pe_master_service = 'pe-httpd'
|
112
|
+
|
113
|
+
service { "$pe_master_service":
|
114
|
+
ensure => running,
|
115
|
+
}
|
116
|
+
MANIFEST
|
117
|
+
|
118
|
+
manifest
|
119
|
+
end
|
120
|
+
|
121
|
+
def gen_puppetserver
|
122
|
+
manifest = <<-MANIFEST.gsub(/^\s{6}/, '')
|
123
|
+
$pe_master_service = 'pe-puppetserver'
|
124
|
+
|
125
|
+
service { "$pe_master_service":
|
102
126
|
ensure => running,
|
103
127
|
}
|
104
128
|
MANIFEST
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems/version'
|
2
|
+
|
3
|
+
module PEBuild
|
4
|
+
module Util
|
5
|
+
# @api private
|
6
|
+
#
|
7
|
+
# @since 0.10.2
|
8
|
+
module VersionString
|
9
|
+
|
10
|
+
# Approximate comparison of two version strings using <=>
|
11
|
+
#
|
12
|
+
# Uses the Gem::Version class. Any nightly build tags, such as
|
13
|
+
# `-rc4-165-g9a98c9f`, will be stripped from the version.
|
14
|
+
#
|
15
|
+
# @param a [String] The first version string.
|
16
|
+
# @param b [String] The second version string.
|
17
|
+
#
|
18
|
+
# @return [Integer] A -1, 0 or 1.
|
19
|
+
def self.compare(a, b)
|
20
|
+
Gem::Version.new(a.split('-').first) <=> Gem::Version.new(b.split('-').first)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/pe_build/version.rb
CHANGED
data/tasks/acceptance.rake
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
namespace :acceptance do
|
2
2
|
ARTIFACT_DIR = File.join('acceptance', 'artifacts')
|
3
|
-
TEST_BOXES =
|
4
|
-
https://
|
5
|
-
|
3
|
+
TEST_BOXES = {
|
4
|
+
'virtualbox.box' => 'https://s3.amazonaws.com/puppetlabs-vagrantcloud/centos-6.6-x86_64-virtualbox-nocm-1.0.1.box'
|
5
|
+
}
|
6
6
|
|
7
7
|
directory ARTIFACT_DIR
|
8
|
-
TEST_BOXES.each do |box_url|
|
9
|
-
file File.join(ARTIFACT_DIR,
|
8
|
+
TEST_BOXES.each do |box, box_url|
|
9
|
+
file File.join(ARTIFACT_DIR, box) => ARTIFACT_DIR do |path|
|
10
10
|
puts 'Downloading: ' + box_url
|
11
11
|
Kernel.system 'curl', '-L', '-o', path.to_s, box_url
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'downloads test boxes and other artifacts'
|
16
|
-
task :setup => TEST_BOXES.map {|
|
16
|
+
task :setup => TEST_BOXES.map {|box, _| File.join(ARTIFACT_DIR, box)}
|
17
17
|
|
18
18
|
desc 'runs acceptance tests'
|
19
19
|
task :run => :setup do
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-pe_build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Thebo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: progressbar
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitar
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.14.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.14.0
|
69
69
|
description:
|
@@ -72,16 +72,17 @@ executables: []
|
|
72
72
|
extensions: []
|
73
73
|
extra_rdoc_files: []
|
74
74
|
files:
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
75
|
+
- .gitignore
|
76
|
+
- .rspec
|
77
|
+
- .travis.yml
|
78
|
+
- .yardopts
|
79
79
|
- CHANGELOG
|
80
80
|
- Gemfile
|
81
81
|
- LICENSE
|
82
82
|
- README.markdown
|
83
83
|
- Rakefile
|
84
|
-
- acceptance/pe_build/
|
84
|
+
- acceptance/pe_build/pe_bootstrap_3x_spec.rb
|
85
|
+
- acceptance/pe_build/pe_bootstrap_latest_spec.rb
|
85
86
|
- acceptance/skeletons/pe_build/Vagrantfile
|
86
87
|
- acceptance/skeletons/pe_build/agent-3.x.txt.erb
|
87
88
|
- doc/answers/README.markdown
|
@@ -146,6 +147,7 @@ files:
|
|
146
147
|
- lib/pe_build/unpack/tar.rb
|
147
148
|
- lib/pe_build/unpack/tar_gz.rb
|
148
149
|
- lib/pe_build/util/config.rb
|
150
|
+
- lib/pe_build/util/version_string.rb
|
149
151
|
- lib/pe_build/util/versioned_path.rb
|
150
152
|
- lib/pe_build/version.rb
|
151
153
|
- lib/vagrant-pe_build.rb
|
@@ -178,19 +180,18 @@ require_paths:
|
|
178
180
|
- lib
|
179
181
|
required_ruby_version: !ruby/object:Gem::Requirement
|
180
182
|
requirements:
|
181
|
-
- -
|
183
|
+
- - '>='
|
182
184
|
- !ruby/object:Gem::Version
|
183
185
|
version: '0'
|
184
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
187
|
requirements:
|
186
|
-
- -
|
188
|
+
- - '>='
|
187
189
|
- !ruby/object:Gem::Version
|
188
190
|
version: '0'
|
189
191
|
requirements: []
|
190
192
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.
|
193
|
+
rubygems_version: 2.0.14
|
192
194
|
signing_key:
|
193
195
|
specification_version: 4
|
194
196
|
summary: Vagrant provisioner for installing Puppet Enterprise
|
195
197
|
test_files: []
|
196
|
-
has_rdoc:
|
@@ -1,50 +0,0 @@
|
|
1
|
-
shared_examples 'provider/provisioner/pe_build' do |provider, options|
|
2
|
-
if !File.file?(options[:box])
|
3
|
-
raise ArgumentError,
|
4
|
-
"A box file must be downloaded for provider: #{provider}. Try: rake acceptance:setup"
|
5
|
-
end
|
6
|
-
|
7
|
-
include_context 'acceptance'
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
environment.skeleton('pe_build')
|
11
|
-
assert_execute('vagrant', 'box', 'add', 'box', options[:box])
|
12
|
-
end
|
13
|
-
|
14
|
-
after(:each) do
|
15
|
-
# Ensure any VMs that survived tests are cleaned up.
|
16
|
-
assert_execute('vagrant', 'destroy', '--force', log: false)
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'when download_root is set to a local directory' do
|
20
|
-
let(:extra_env) do
|
21
|
-
vars = options[:env_vars].dup
|
22
|
-
vars['PE_BUILD_DOWNLOAD_ROOT'] = options[:archive_path]
|
23
|
-
|
24
|
-
vars
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'provisions with pe_build' do
|
28
|
-
assert_execute('vagrant', 'up', "--provider=#{provider}", 'explicit-version')
|
29
|
-
assert_execute('vagrant', 'up', "--provider=#{provider}", 'latest-version')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'when download_root is set to a webserver' do
|
34
|
-
let(:webserver_port) { 3838 }
|
35
|
-
let(:webserver_path) { options[:archive_path] }
|
36
|
-
include_context 'webserver'
|
37
|
-
|
38
|
-
let(:extra_env) do
|
39
|
-
vars = options[:env_vars].dup
|
40
|
-
vars['PE_BUILD_DOWNLOAD_ROOT'] = "http://localhost:#{webserver_port}/"
|
41
|
-
|
42
|
-
vars
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'provisions with pe_build' do
|
46
|
-
assert_execute('vagrant', 'up', "--provider=#{provider}", 'explicit-version')
|
47
|
-
assert_execute('vagrant', 'up', "--provider=#{provider}", 'latest-version')
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|