vagrant-puppet-install 2.7.0 → 3.0.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: 6278410fd5571374a78f0d9d3df000067fe16ae2
4
- data.tar.gz: e53c78bd89cbe5e9b25ea6dc87f1ad851f0f58f2
3
+ metadata.gz: c6f07f33f3b11dddced68140c3699678635861ce
4
+ data.tar.gz: 2cc0a91c05b3a58b85c5bef1ddb8f61746db77c7
5
5
  SHA512:
6
- metadata.gz: 7e769244db972e41338de621546933df3b4169afa1fb30cc914db65634ea0f9f26cea83880681d71c6b768b6ca17a8b64381078ae87fa2cfa3002aa852bcd049
7
- data.tar.gz: 69e594cf65587973de5dc8ae6a260f10987c0796a8a087811297d2f4c5638663637f383c7b8fb61142e2c9ea3783d7bb873577fb84244145d872b48ea43c33f0
6
+ metadata.gz: 73810232072cc4e09263f8960391b647b55da24aa985c69a58392811efa1a4d9a77d46fd0d9df9f9bab3ba89c4ecd35c2aa90864e76b89ec79b20aaa1f34d94a
7
+ data.tar.gz: 23b663ff0a03b9b1fddce08498c0c0177c75fabecbb7557c1994cc65aea417ff734bda8af0e8c7643bafb942fd8b826d988eb1b1b5b6cca12dd08b22c3b6a26f
@@ -1,6 +1,5 @@
1
1
  rvm:
2
- - 2.0.0
3
2
  - 2.1.0
4
3
  bundler_args: --jobs 7 --without=acceptance
5
4
  script:
6
- - bundle exec rake test:unit
5
+ - bundle exec rake test:unit
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ group :development do
6
6
  # We depend on Vagrant for development, but we don't add it as a
7
7
  # gem dependency because we expect to be installed within the
8
8
  # Vagrant environment itself using `vagrant plugin`.
9
- gem 'vagrant', git: 'git://github.com/mitchellh/vagrant.git', ref: 'bb22a37ed1989403e25e889d913b512090a5737f'
9
+ gem 'vagrant', git: 'git://github.com/mitchellh/vagrant.git', tag: 'v1.7.4'
10
10
  end
11
11
 
12
12
  group :acceptance do
@@ -16,7 +16,7 @@ group :acceptance do
16
16
  end
17
17
 
18
18
  group :docs do
19
- gem "yard", "~> 0.8.5"
20
- gem "redcarpet", "~> 2.2.2"
21
- gem "github-markup", "~> 0.7.5"
19
+ gem 'yard', '~> 0.8.5'
20
+ gem 'redcarpet', '~> 2.2.2'
21
+ gem 'github-markup', '~> 0.7.5'
22
22
  end
data/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # vagrant-puppet-install
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/vagrant-puppet-install.png)](http://badge.fury.io/rb/vagrant-puppet-install)
4
- [![Build Status](https://travis-ci.org/petems/vagrant-puppet-install.png?branch=master)](https://travis-ci.org/petems/vagrant-puppet-install)
5
- [![Dependency Status](https://gemnasium.com/petems/vagrant-puppet-install.png)](https://gemnasium.com/petems/vagrant-puppet-install)
6
- [![Code Climate](https://codeclimate.com/github/petems/vagrant-puppet-install.png)](https://codeclimate.com/github/petems/vagrant-puppet-install)
3
+ [![Gem Version](http://img.shields.io/gem/v/vagrant-puppet-install.svg)][gem]
4
+ [![Build Status](http://img.shields.io/travis/petems/vagrant-puppet-install.svg)][travis]
5
+ [![Dependency Status](http://img.shields.io/gemnasium/petems/vagrant-puppet-install.svg)][gemnasium]
6
+ [![Code Climate](http://img.shields.io/codeclimate/github/petems/vagrant-puppet-install.svg)][codeclimate]
7
+
8
+ [gem]: https://rubygems.org/gems/vagrant-puppet-install
9
+ [travis]: http://travis-ci.org/petems/vagrant-puppet-install
10
+ [gemnasium]: https://gemnasium.com/petems/vagrant-puppet-install
11
+ [codeclimate]: https://codeclimate.com/github/petems/vagrant-puppet-install
12
+
7
13
 
8
14
  A Vagrant plugin that ensures the desired version of Puppet is installed via the
9
15
  Puppet Labs package repo. This proves very useful when using Vagrant
@@ -35,7 +41,9 @@ $ vagrant plugin install vagrant-puppet-install
35
41
  The Puppet Install Vagrant plugin automatically hooks into the Vagrant provisioning
36
42
  middleware. You specify the version of the `puppet-common` package you want
37
43
  installed using the `puppet_install.puppet_version` config key. The version string
38
- should be a valid Puppet release (ie. `2.7.11`, `3.0.*`, etc.).
44
+ should be a valid Puppet release (ie. `2.7.11`, `3.7.4`, etc.).
45
+
46
+ The Puppet version is validated against the RubyGems API, so you can use gem syntax to give a [pessimistic version constraint](http://guides.rubygems.org/patterns/#pessimistic-version-constraint) such as `~> 2.7` which will return the latest version of the 2.7.*.
39
47
 
40
48
  Install the latest version of Puppet:
41
49
 
@@ -62,7 +62,11 @@ module VagrantPlugins
62
62
  if windows_guest?
63
63
  # No Windows Version yet
64
64
  else
65
- 'https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet.sh'
65
+ if ( @machine.config.puppet_install.puppet_version == 'latest' || @machine.config.puppet_install.puppet_version.match(/^4\..+/) )
66
+ 'https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet_agent.sh'
67
+ else
68
+ 'https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet.sh'
69
+ end
66
70
  end
67
71
  end
68
72
 
@@ -19,6 +19,9 @@ module VagrantPlugins
19
19
  elsif @puppet_version.to_s == 'latest'
20
20
  # resolve `latest` to a real version
21
21
  @puppet_version = retrieve_latest_puppet_version
22
+ elsif valid_puppet_version?(puppet_version)
23
+ # allows for pessimistic version constraint
24
+ @puppet_version = retrieve_latest_puppet_version(puppet_version)
22
25
  end
23
26
  @install_url = nil if @install_url == UNSET_VALUE
24
27
  end
@@ -48,9 +51,9 @@ A list of valid versions can be found at: http://docs.puppetlabs.com/release_not
48
51
  private
49
52
 
50
53
  # Query RubyGems.org's Ruby API and retrive the latest version of Puppet.
51
- def retrieve_latest_puppet_version
54
+ def retrieve_latest_puppet_version(version = nil)
52
55
  available_gems =
53
- dependency_installer.find_gems_with_sources(puppet_gem_dependency)
56
+ dependency_installer.find_gems_with_sources(puppet_gem_dependency(version))
54
57
  spec, _source =
55
58
  if available_gems.respond_to?(:last)
56
59
  # DependencyInstaller sorts the results such that the last one is
@@ -1,7 +1,3 @@
1
- if Vagrant::VERSION < '1.1.0'
2
- fail 'The Vagrant Puppet Install plugin is only compatible with Vagrant 1.1+'
3
- end
4
-
5
1
  module VagrantPlugins
6
2
  module PuppetInstall
7
3
  class Plugin < Vagrant.plugin('2')
@@ -11,6 +7,31 @@ module VagrantPlugins
11
7
  via the Puppet Labs package repos.
12
8
  DESC
13
9
 
10
+ VAGRANT_VERSION_REQUIREMENT = '>= 1.1.0'
11
+
12
+ # Returns true if the Vagrant version fulfills the requirements
13
+ #
14
+ # @param requirements [String, Array<String>] the version requirement
15
+ # @return [Boolean]
16
+ def self.check_vagrant_version(*requirements)
17
+ Gem::Requirement.new(*requirements).satisfied_by?(
18
+ Gem::Version.new(Vagrant::VERSION))
19
+ end
20
+
21
+ # Verifies that the Vagrant version fulfills the requirements
22
+ #
23
+ # @raise [VagrantPlugins::ProxyConf::VagrantVersionError] if this plugin
24
+ # is incompatible with the Vagrant version
25
+ def self.check_vagrant_version!
26
+ unless check_vagrant_version(VAGRANT_VERSION_REQUIREMENT)
27
+ msg = I18n.t(
28
+ 'vagrant-puppet_install.errors.vagrant_version',
29
+ requirement: VAGRANT_VERSION_REQUIREMENT.inspect)
30
+ $stderr.puts msg
31
+ fail msg
32
+ end
33
+ end
34
+
14
35
  action_hook(:install_puppet, Plugin::ALL_ACTIONS) do |hook|
15
36
  require_relative 'action/install_puppet'
16
37
  hook.after(Vagrant::Action::Builtin::Provision, Action::InstallPuppet)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module PuppetInstall
3
- VERSION = "2.7.0"
3
+ VERSION = "3.0.0"
4
4
  end
5
- end
5
+ end
@@ -6,3 +6,6 @@ en:
6
6
  download:
7
7
  downloading: "Downloading or copying install.sh..."
8
8
  interrupted: "Install.sh download was interrupted. Exiting."
9
+ errors:
10
+ vagrant_version: |-
11
+ vagrant-omnibus plugin requires Vagrant version %{requirement}
@@ -9,7 +9,7 @@ Vagrant.configure("2") do |config|
9
9
  config.vm.define :ubuntu do |ubuntu|
10
10
  ubuntu.puppet_install.puppet_version = '3.6.1'
11
11
 
12
- ubuntu.vm.box = "chef/ubuntu-12.04"
12
+ ubuntu.vm.box = "puppetlabs/ubuntu-12.04-64-nocm"
13
13
 
14
14
  ubuntu.vm.provision :puppet do |puppet|
15
15
  puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__)
@@ -20,9 +20,24 @@ Vagrant.configure("2") do |config|
20
20
 
21
21
  end
22
22
 
23
+ config.vm.define :gh6 do |gh6|
24
+ gh6.puppet_install.puppet_version = '2.7.23'
25
+
26
+ gh6.vm.box = "puppetlabs/ubuntu-12.04-64-nocm"
27
+ gh6.vm.provision "shell", inline: "puppet --version"
28
+
29
+ gh6.vm.provision :puppet do |puppet|
30
+ puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__)
31
+ puppet.manifest_file = "base.pp"
32
+ end
33
+
34
+ gh6.vm.provision "shell", inline: "puppet --version"
35
+
36
+ end
37
+
23
38
  config.vm.define :centos do |centos|
24
39
  centos.puppet_install.puppet_version = :latest
25
- centos.vm.box = "chef/centos-6.5"
40
+ centos.vm.box = "puppetlabs/centos-6.6-64-nocm"
26
41
 
27
42
  centos.vm.provision :puppet do |puppet|
28
43
  puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__)
@@ -36,7 +51,7 @@ Vagrant.configure("2") do |config|
36
51
  config.vm.define :new_install_url do |new_install_url|
37
52
  new_install_url.puppet_install.puppet_version = :latest
38
53
  new_install_url.puppet_install.install_url = 'https://raw.githubusercontent.com/hashicorp/puppet-bootstrap/master/centos_6_x.sh'
39
- new_install_url.vm.box = "chef/centos-6.5"
54
+ new_install_url.vm.box = "puppetlabs/centos-6.6-64-nocm"
40
55
 
41
56
  new_install_url.vm.provision :puppet do |puppet|
42
57
  puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__)
@@ -50,7 +65,7 @@ Vagrant.configure("2") do |config|
50
65
  config.vm.define :new_install_path do |new_install_path|
51
66
  new_install_path.puppet_install.puppet_version = :latest
52
67
  new_install_path.puppet_install.install_url = File.expand_path('../../support/puppet_install_script/shell_install.sh')
53
- new_install_path.vm.box = "chef/centos-6.5"
68
+ new_install_path.vm.box = "puppetlabs/centos-6.6-64-nocm"
54
69
 
55
70
  new_install_path.vm.provision :puppet do |puppet|
56
71
  puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__)
@@ -36,6 +36,10 @@ describe VagrantPlugins::PuppetInstall::Config do
36
36
  description: 'valid puppet version string',
37
37
  valid: true
38
38
  },
39
+ '~> 2.7' => {
40
+ description: 'valid puppet version string',
41
+ valid: true
42
+ },
39
43
  '9.9.9' => {
40
44
  description: 'invalid puppet version string',
41
45
  valid: false
@@ -0,0 +1,82 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe VagrantPlugins::PuppetInstall::Plugin do
4
+
5
+ context 'action hooks' do
6
+ let(:hook) { double(append: true, prepend: true) }
7
+ let(:fake_class) { Class.new }
8
+
9
+ it 'should hook InstallPuppet before Provision' do
10
+ stub_const('VagrantPlugins::PuppetInstall::Action::InstallPuppet', fake_class)
11
+ hook_proc = described_class.components.action_hooks[:__all_actions__][0]
12
+ hook = double
13
+ expect(hook).to receive(:after).with(Vagrant::Action::Builtin::Provision, VagrantPlugins::PuppetInstall::Action::InstallPuppet)
14
+ hook_proc.call(hook)
15
+ end
16
+ end
17
+
18
+ it 'should define a config of type :puppet' do
19
+ default_config = described_class.components.configs[:top].to_hash[:"puppet_install"]
20
+ expect(default_config).to be(VagrantPlugins::PuppetInstall::Config)
21
+ end
22
+
23
+ describe '.check_vagrant_version' do
24
+ before :each do
25
+ stub_const('Vagrant::VERSION', '1.2.3')
26
+ end
27
+
28
+ it 'accepts single String argument' do
29
+ expect(described_class.check_vagrant_version('~> 1.1')).to be_true
30
+ expect(described_class.check_vagrant_version('1.2')).to be_false
31
+ end
32
+
33
+ it 'accepts an Array argument' do
34
+ expect(described_class.check_vagrant_version(['>= 1.1', '< 1.3.0.beta'])).to be_true
35
+ expect(described_class.check_vagrant_version(['>= 1.3'])).to be_false
36
+ end
37
+
38
+ it 'accepts multiple arguments' do
39
+ expect(described_class.check_vagrant_version('>= 1.0', '<= 1.3')).to be_true
40
+ expect(described_class.check_vagrant_version('~> 1.2', '>= 1.2.5')).to be_false
41
+ end
42
+ end
43
+
44
+ describe '.check_vagrant_version!' do
45
+ subject { described_class.check_vagrant_version! }
46
+ let(:requirement) { '>= 1.1.0' }
47
+ let(:err_msg) { /requires Vagrant version #{Regexp.escape(requirement.inspect)}/ }
48
+
49
+ before :each do
50
+ stub_const(
51
+ 'VagrantPlugins::ProxyConf::Plugin::VAGRANT_VERSION_REQUIREMENT',
52
+ requirement)
53
+ stub_const('Vagrant::VERSION', vagrant_version)
54
+ $stderr.stub(:puts)
55
+ end
56
+
57
+ context 'on too old Vagrant version' do
58
+ let(:vagrant_version) { '1.0.9' }
59
+ it 'raises error' do
60
+ expect { subject }.to raise_error(err_msg)
61
+ end
62
+ it 'warns as stderr' do
63
+ $stderr.should_receive(:puts).with(err_msg)
64
+ expect { subject }.to raise_error(err_msg)
65
+ end
66
+ end
67
+
68
+ context 'on exact required Vagrant version' do
69
+ let(:vagrant_version) { '1.1.0' }
70
+ it 'does not raise' do
71
+ expect { subject }.not_to raise_error
72
+ end
73
+ end
74
+
75
+ context 'on newer Vagrant version' do
76
+ let(:vagrant_version) { '1.3.5' }
77
+ it 'does not raise' do
78
+ expect { subject }.not_to raise_error
79
+ end
80
+ end
81
+ end
82
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-puppet-install
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Chisamore
@@ -10,62 +10,62 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-11-21 00:00:00.000000000 Z
13
+ date: 2015-12-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '1.3'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: '1.3'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rake
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: 10.1.1
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: 10.1.1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: 2.14.1
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: 2.14.1
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rubocop
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ~>
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
63
  version: 0.17.0
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ~>
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: 0.17.0
71
71
  description: A Vagrant plugin that ensures the desired version of Puppet is installed
@@ -78,11 +78,11 @@ executables: []
78
78
  extensions: []
79
79
  extra_rdoc_files: []
80
80
  files:
81
- - .gitignore
82
- - .rspec
83
- - .rubocop.yml
84
- - .travis.yml
85
- - .yardopts
81
+ - ".gitignore"
82
+ - ".rspec"
83
+ - ".rubocop.yml"
84
+ - ".travis.yml"
85
+ - ".yardopts"
86
86
  - CHANGELOG.md
87
87
  - Gemfile
88
88
  - LICENSE
@@ -102,6 +102,7 @@ files:
102
102
  - test/support/puppet_install_script/shell_install.sh
103
103
  - test/unit/spec_helper.rb
104
104
  - test/unit/vagrant-puppet-install/config_spec.rb
105
+ - test/unit/vagrant-puppet-install/plugin_spec.rb
105
106
  - vagrant-puppet-install.gemspec
106
107
  homepage: https://github.com/patcon/vagrant-puppet-install
107
108
  licenses:
@@ -113,17 +114,17 @@ require_paths:
113
114
  - lib
114
115
  required_ruby_version: !ruby/object:Gem::Requirement
115
116
  requirements:
116
- - - '>='
117
+ - - ">="
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  required_rubygems_version: !ruby/object:Gem::Requirement
120
121
  requirements:
121
- - - '>='
122
+ - - ">="
122
123
  - !ruby/object:Gem::Version
123
124
  version: '0'
124
125
  requirements: []
125
126
  rubyforge_project:
126
- rubygems_version: 2.4.1
127
+ rubygems_version: 2.5.1
127
128
  signing_key:
128
129
  specification_version: 4
129
130
  summary: A Vagrant plugin that ensures the desired version of Puppet is installed
@@ -137,4 +138,5 @@ test_files:
137
138
  - test/support/puppet_install_script/shell_install.sh
138
139
  - test/unit/spec_helper.rb
139
140
  - test/unit/vagrant-puppet-install/config_spec.rb
141
+ - test/unit/vagrant-puppet-install/plugin_spec.rb
140
142
  has_rdoc: