vagrant-pe_build 0.10.1 → 0.10.2

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: 355da7b9e79746b79c4ccf345a1621829ba742e9
4
- data.tar.gz: 3bb3a1c6ea2b98e6c0ed58bc32ea7f735fd3aabc
3
+ metadata.gz: fab41cebad5a61a3fabebcabe67f0110a8722b7a
4
+ data.tar.gz: f1cf6cb8270f2e4b145eb11d32867f71f135fb5e
5
5
  SHA512:
6
- metadata.gz: f17168a6942f7d7bce0b71311b7de4345b7de00f4c9993a949b7e39862dd8576cf5659aeaf710627942f413dd0c84814f50dab5bc87b377238308e717f282108
7
- data.tar.gz: eec273bcbbfc37e7c13fb7af89204aa1a230de93d5997ca18a8d50d3d61cc320ceb5192dc208348660099d535f84d51cc192c7dcd9e8c6d0dbccc7098d60fdf6
6
+ metadata.gz: 89518f8d9c34e9b6f8586a31b37bfd2c358056959539e53f727da5b7e8a0c746d0f76305674c062f42121adb4eb4fb0bbf1a59e4c8836e7261a81df20293a66f
7
+ data.tar.gz: b0f3fab88367f4b524a1dea56ef10e7197d7bd3be812370df8ec2e691728878128b52be239e14b8f88d2a3f123fe57d60bcaf045a4c78b726a0629f158cf4916
data/CHANGELOG CHANGED
@@ -1,6 +1,15 @@
1
1
  vagrant-pe_build
2
2
  ================
3
3
 
4
+ 0.10.2
5
+ ------
6
+
7
+ 2015-06-08
8
+
9
+ This is a backwards compatible bugfix release.
10
+
11
+ * Fix compatibility issues with Puppet Server and Puppet 4.
12
+
4
13
  0.10.1
5
14
  ------
6
15
 
@@ -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 'explicit-version' do |node|
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.2.3'
8
- p.role = :agent
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-version' do |node|
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 = 'LATEST'
18
- p.role = :agent
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
- if machine.communicate.test('test -f /opt/puppet/pe_version')
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 = attr(:download_root) if attr(:download_root)
40
- global_config.pe_build.version = attr(:version) if attr(:version)
41
- global_config.pe_build.version_file = attr(:version_file) if attr(:version_file)
42
- global_config.pe_build.series = attr(:series) if attr(:series)
43
- global_config.pe_build.suffix = attr(:suffix) if attr(:suffix)
44
- global_config.pe_build.filename = attr(:filename) if attr(: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 = attr(:download_root) if attr(:download_root)
48
- pe.version = attr(:version) if attr(:version)
49
- pe.version_file = attr(:version_file) if attr(:version_file)
50
- pe.series = attr(:series) if attr(:series)
51
- pe.suffix = attr(:suffix) if attr(:suffix)
52
- pe.filename = attr(:filename) if attr(: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 = attr(:role) if attr(:role)
55
- pe.verbose = attr(:verbose) if attr(:verbose)
56
- pe.master = attr(:master) if attr(:master)
57
- pe.answer_file = attr(:answer_file) if attr(:answer_file)
58
- pe.relocate_manifests = attr(:relocate_manifests) if attr(:relocate_manifests)
59
- pe.autosign = attr(:autosign) if attr(: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
- puppet_apply = "/opt/puppet/bin/puppet apply"
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['pe-httpd'],
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['pe-httpd'],
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['pe-httpd'],
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['pe-httpd'],
102
+ notify => Service[$pe_master_service],
93
103
  }
94
104
  MANIFEST
95
105
 
96
106
  manifest
97
107
  end
98
108
 
99
- def gen_service
109
+ def gen_httpd
100
110
  manifest = <<-MANIFEST.gsub(/^\s{6}/, '')
101
- service { 'pe-httpd':
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
@@ -1,3 +1,3 @@
1
1
  module PEBuild
2
- VERSION = '0.10.1'
2
+ VERSION = '0.10.2'
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'webrick/https'
1
+ require 'webrick'
2
2
 
3
3
  # This context runs a WEBRick server that is accessible to tests.
4
4
  # The `webserver_port` and `webserver_path` will need to be specified before
@@ -1,19 +1,19 @@
1
1
  namespace :acceptance do
2
2
  ARTIFACT_DIR = File.join('acceptance', 'artifacts')
3
- TEST_BOXES = %w[
4
- https://vagrantcloud.com/puppetlabs/centos-6.5-64-nocm/version/2/provider/virtualbox.box
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, File.basename(box_url)) => ARTIFACT_DIR do |path|
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 {|box_url| File.join(ARTIFACT_DIR, File.basename(box_url))}
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.1
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-04-28 00:00:00.000000000 Z
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
- - ".gitignore"
76
- - ".rspec"
77
- - ".travis.yml"
78
- - ".yardopts"
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/pe_build_spec.rb
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.4.5
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