vagrant-puppet-install 2.0.1 → 2.1.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: 6599a8b58123a862cde897c4189ca047e5d52e35
4
- data.tar.gz: 92e5b8fc21a96cbcb8141e0029954c5ac43119bb
3
+ metadata.gz: 961d7f1b5bfba02b4b6772c70386a62296fb8b92
4
+ data.tar.gz: bd66512f848d2c01eee2662dcc77f3857ef6bfc1
5
5
  SHA512:
6
- metadata.gz: 2f87c1fef953092e28edc54baeeac965b01e1935e7dcb49457ea3d5a21ff59946ec089b8a66028ed54fa543ced95f18c14536b9fa498b52640d92940bf6f53a2
7
- data.tar.gz: a37fdc2f455827840dcc4a20c150c51cd96b3f201d0968c7822905498ad5e88481619873ff5541c46bb08ebc63b66efb0f23efbc96f6ab0d3c09ebbcb9a0c857
6
+ metadata.gz: 275de845b16817fe0b5728dd07ad1146d5742c5191f763a1c54a11caaf89cfb7b13cf4f7b06a0b7ef48a0e98c0da3e6e8c731947f8e25e943cd2cb18183342c3
7
+ data.tar.gz: 9b89e687f0be7a89001d79c35e2c4600aa5f741639f626aad7c3209d3d677cae2b0c4636986f5aaaa0cb46acf3cfc3c0085d6241693cd4ab5db36feefae1717e
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", :tag => "v1.3.5"
9
+ gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => "v1.4.3"
10
10
  end
11
11
 
12
12
  group :acceptance do
@@ -14,12 +14,18 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "pathname"
18
- require "vagrant-puppet-install/plugin"
17
+ require 'vagrant'
18
+ require 'vagrant-puppet-install/plugin'
19
+ require 'vagrant-puppet-install/config'
19
20
 
20
21
  module VagrantPlugins
22
+ #
21
23
  module PuppetInstall
22
- autoload :Action, 'vagrant-puppet-install/action'
23
- autoload :Config, 'vagrant-puppet-install/config'
24
+ def self.source_root
25
+ @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
26
+ end
27
+
28
+ I18n.load_path << File.expand_path('locales/en.yml', source_root)
29
+ I18n.reload!
24
30
  end
25
31
  end
@@ -42,8 +42,7 @@ module VagrantPlugins
42
42
  return unless @machine.communicate.ready? && provision_enabled?(env)
43
43
 
44
44
  desired_version = @machine.config.puppet_install.puppet_version
45
-
46
- unless desired_version.nil?
45
+ unless desired_version.nil?
47
46
  if installed_version == desired_version
48
47
  env[:ui].info I18n.t(
49
48
  'vagrant-puppet_install.action.installed',
@@ -59,8 +58,6 @@ module VagrantPlugins
59
58
  recover(env)
60
59
  end
61
60
  end
62
-
63
- @app.call(env)
64
61
  end
65
62
 
66
63
  private
@@ -69,13 +66,19 @@ module VagrantPlugins
69
66
  def find_install_script
70
67
  if !ENV['PUPPET_INSTALL_URL'].nil?
71
68
  ENV['PUPPET_INSTALL_URL']
69
+ elsif windows_guest?
70
+ #
72
71
  else
73
72
  'https://raw2.github.com/petems/puppet-install-shell/master/install_puppet.sh'
74
73
  end
75
74
  end
76
75
 
77
76
  def install_script_name
78
- 'install.sh'
77
+ if windows_guest?
78
+ #
79
+ else
80
+ 'install.sh'
81
+ end
79
82
  end
80
83
 
81
84
  def windows_guest?
@@ -19,16 +19,17 @@ require 'rubygems/dependency_installer'
19
19
  require 'vagrant'
20
20
 
21
21
  module VagrantPlugins
22
+ #
22
23
  module PuppetInstall
23
24
  # @author Seth Chisamore <schisamo@opscode.com>
24
- class Config < Vagrant.plugin("2", :config)
25
-
25
+ class Config < Vagrant.plugin('2', :config)
26
26
  # @return [String]
27
27
  # The version of Puppet to install.
28
28
  attr_accessor :puppet_version
29
29
 
30
30
  def initialize
31
31
  @puppet_version = UNSET_VALUE
32
+ @logger = Log4r::Logger.new('vagrantplugins::puppet_install::config')
32
33
  end
33
34
 
34
35
  def finalize!
@@ -44,31 +45,36 @@ module VagrantPlugins
44
45
  errors = []
45
46
 
46
47
  unless valid_puppet_version?(puppet_version)
47
- msg = "'#{puppet_version}' is not a valid version of Puppet."
48
- msg << "\n\n A list of valid versions can be found at: http://docs.puppetlabs.com/release_notes/"
48
+ msg = <<-EOH
49
+ '#{ puppet_version }' is not a valid version of Puppet.
50
+
51
+ A list of valid versions can be found at: http://docs.puppetlabs.com/release_notes/
52
+ EOH
49
53
  errors << msg
50
54
  end
51
55
 
52
- { "Puppet Install Plugin" => errors }
56
+ { 'Puppet Install Plugin' => errors }
53
57
  end
54
58
 
55
59
  private
56
60
 
57
61
  # Query RubyGems.org's Ruby API and retrive the latest version of Puppet.
58
62
  def retrieve_latest_puppet_version
59
- available_gems = dependency_installer.find_gems_with_sources(puppet_gem_dependency)
60
- spec, source = if available_gems.respond_to?(:last)
61
- # DependencyInstaller sorts the results such that the last one is
62
- # always the one it considers best.
63
- spec_with_source = available_gems.last
64
- spec_with_source
65
- else
66
- # Rubygems 2.0 returns a Gem::Available set, which is a
67
- # collection of AvailableSet::Tuple structs
68
- available_gems.pick_best!
69
- best_gem = available_gems.set.first
70
- best_gem && [best_gem.spec, best_gem.source]
71
- end
63
+ available_gems =
64
+ dependency_installer.find_gems_with_sources(puppet_gem_dependency)
65
+ spec, _source =
66
+ if available_gems.respond_to?(:last)
67
+ # DependencyInstaller sorts the results such that the last one is
68
+ # always the one it considers best.
69
+ spec_with_source = available_gems.last
70
+ spec_with_source
71
+ else
72
+ # Rubygems 2.0 returns a Gem::Available set, which is a
73
+ # collection of AvailableSet::Tuple structs
74
+ available_gems.pick_best!
75
+ best_gem = available_gems.set.first
76
+ best_gem && [best_gem.spec, best_gem.source]
77
+ end
72
78
 
73
79
  spec && spec.version.to_s
74
80
  end
@@ -78,9 +84,12 @@ module VagrantPlugins
78
84
  def valid_puppet_version?(version)
79
85
  is_valid = false
80
86
  begin
81
- available = dependency_installer.find_gems_with_sources(puppet_gem_dependency(version))
87
+ available = dependency_installer.find_gems_with_sources(
88
+ puppet_gem_dependency(version)
89
+ )
82
90
  is_valid = true unless available.empty?
83
- rescue
91
+ rescue ArgumentError => e
92
+ @logger.debug("#{version} is not a valid Puppet version: #{e}")
84
93
  end
85
94
  is_valid
86
95
  end
@@ -89,7 +98,7 @@ module VagrantPlugins
89
98
  @dependency_installer ||= Gem::DependencyInstaller.new
90
99
  end
91
100
 
92
- def puppet_gem_dependency(version=nil)
101
+ def puppet_gem_dependency(version = nil)
93
102
  Gem::Dependency.new('puppet', version)
94
103
  end
95
104
  end
@@ -14,65 +14,40 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- begin
18
- require "vagrant"
19
- rescue LoadError
20
- raise "The vagrant-puppet-install plugin must be run within Vagrant."
21
- end
22
-
23
17
  # This is a sanity check to make sure no one is attempting to install
24
18
  # this into an early Vagrant version.
25
- if Vagrant::VERSION < "1.1.0"
26
- raise "The vagrant-puppet-install plugin is only compatible with Vagrant 1.1+"
27
- end
28
-
29
- if Vagrant::VERSION < "1.3.5"
30
- raise "The vagrant-puppet-install plugin is only compatible with Vagrant 1.3.5 <= right now.\n See https://github.com/patcon/vagrant-puppet-install/issues/5 for details"
19
+ if Vagrant::VERSION < '1.1.0'
20
+ fail 'The Vagrant Puppet Install plugin is only compatible with Vagrant 1.1+'
31
21
  end
32
22
 
33
23
  module VagrantPlugins
24
+ #
34
25
  module PuppetInstall
35
26
  # @author Seth Chisamore <schisamo@opscode.com>
36
- class Plugin < Vagrant.plugin("2")
37
- name "Puppet Install"
27
+ class Plugin < Vagrant.plugin('2')
28
+ name 'vagrant-puppet-install'
38
29
  description <<-DESC
39
30
  This plugin ensures the desired version of Puppet is installed
40
31
  via the Puppet Labs package repos.
41
32
  DESC
42
33
 
43
- def self.provision(hook)
44
-
45
- hook.after(Vagrant::Action::Builtin::Provision, Action.install_puppet)
34
+ action_hook(:install_pupet, Plugin::ALL_ACTIONS) do |hook|
35
+ require_relative 'action/install_puppet'
36
+ hook.after(Vagrant::Action::Builtin::Provision, Action::InstallPuppet)
46
37
 
47
- # BEGIN workaround
38
+ # The AWS provider < v0.4.0 uses a non-standard Provision action
39
+ # on initial creation:
48
40
  #
49
- # Currently hooks attached to {Vagrant::Action::Builtin::Provision} are
50
- # not wired into the middleware return path. My current workaround is to
51
- # fire after anything boot related which wedges in right before the
52
- # actual real run of the provisioner.
53
-
54
- hook.after(VagrantPlugins::ProviderVirtualBox::Action::Boot, Action.install_puppet)
55
-
56
- if VagrantPlugins.const_defined?("AWS")
57
- hook.after(VagrantPlugins::AWS::Action::RunInstance, Action.install_puppet)
58
- end
59
-
60
- if VagrantPlugins.const_defined?("Rackspace")
61
- # The `VagrantPlugins::Rackspace` module is missing the autoload for
62
- # `VagrantPlugins::Rackspace::Action` so we need to ensure it is
63
- # loaded before accessing the module in the after hook below.
64
- require 'vagrant-rackspace/action'
65
- hook.after(VagrantPlugins::Rackspace::Action::CreateServer, Action.install_puppet)
41
+ # mitchellh/vagrant-aws/blob/v0.3.0/lib/vagrant-aws/action.rb#L105
42
+ #
43
+ if defined? VagrantPlugins::AWS::Action::TimedProvision
44
+ hook.after(VagrantPlugins::AWS::Action::TimedProvision,
45
+ Action::InstallPuppet)
66
46
  end
67
-
68
- # END workaround
69
47
  end
70
48
 
71
- action_hook(:install_puppet, :machine_action_up, &method(:provision))
72
- action_hook(:install_puppet, :machine_action_provision, &method(:provision))
73
-
74
49
  config(:puppet_install) do
75
- require_relative "config"
50
+ require_relative 'config'
76
51
  Config
77
52
  end
78
53
  end
@@ -16,6 +16,6 @@
16
16
 
17
17
  module VagrantPlugins
18
18
  module PuppetInstall
19
- VERSION = "2.0.1"
19
+ VERSION = "2.1.0"
20
20
  end
21
21
  end
data/locales/en.yml ADDED
@@ -0,0 +1,8 @@
1
+ en:
2
+ vagrant-puppet-install:
3
+ action:
4
+ installed: "Puppet %{version} package is already installed."
5
+ installing: "Installing Puppet %{version} package..."
6
+ download:
7
+ downloading: "Downloading or copying install.sh..."
8
+ interrupted: "Install.sh download was interrupted. Exiting."
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.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Chisamore
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-20 00:00:00.000000000 Z
13
+ date: 2014-02-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -89,13 +89,11 @@ files:
89
89
  - README.md
90
90
  - Rakefile
91
91
  - lib/vagrant-puppet-install.rb
92
- - lib/vagrant-puppet-install/action.rb
93
92
  - lib/vagrant-puppet-install/action/install_puppet.rb
94
- - lib/vagrant-puppet-install/action/is_running_or_active.rb
95
- - lib/vagrant-puppet-install/action/read_puppet_version.rb
96
93
  - lib/vagrant-puppet-install/config.rb
97
94
  - lib/vagrant-puppet-install/plugin.rb
98
95
  - lib/vagrant-puppet-install/version.rb
96
+ - locales/en.yml
99
97
  - test/acceptance/aws/Vagrantfile
100
98
  - test/acceptance/digital_ocean/Vagrantfile
101
99
  - test/acceptance/rackspace/Vagrantfile
@@ -1,45 +0,0 @@
1
- #
2
- # Copyright (c) 2013, Seth Chisamore
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- require "vagrant/action/builder"
18
-
19
- module VagrantPlugins
20
- module PuppetInstall
21
- module Action
22
- autoload :InstallPuppet, File.expand_path("../action/install_puppet", __FILE__)
23
- autoload :IsRunningOrActive, File.expand_path("../action/is_running_or_active", __FILE__)
24
- autoload :ReadPuppetVersion, File.expand_path("../action/read_puppet_version", __FILE__)
25
-
26
- # Include the built-in modules so that we can use them as top-level
27
- # things.
28
- include Vagrant::Action::Builtin
29
-
30
- # @return [::Vagrant::Action::Builder]
31
- def self.install_puppet
32
- @install_puppet ||= ::Vagrant::Action::Builder.new.tap do |b|
33
- b.use ConfigValidate
34
- b.use Call, IsRunningOrActive do |env1, b2|
35
- if env1[:result]
36
- b2.use ReadPuppetVersion
37
- b2.use InstallPuppet
38
- b2.use SSHRun
39
- end
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,47 +0,0 @@
1
- #
2
- # Copyright (c) 2013, Seth Chisamore
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- module VagrantPlugins
18
- module PuppetInstall
19
- module Action
20
- # @author Seth Chisamore <schisamo@opscode.com>
21
- #
22
- # This action checks if the machine is running (virtualbox) or active
23
- # (aws, rackspace).
24
- #
25
- class IsRunningOrActive
26
- def initialize(app, env)
27
- @app = app
28
- end
29
-
30
- def call(env)
31
- # Set the result to be true if the machine is :running or :active.
32
- if (env[:machine].state.id == :running) ||
33
- (env[:machine].state.id == :active)
34
-
35
- env[:result] = true
36
- else
37
- env[:result] = false
38
- end
39
-
40
- # Call the next if we have one (but we shouldn't, since this
41
- # middleware is built to run with the Call-type middlewares)
42
- @app.call(env)
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,53 +0,0 @@
1
- #
2
- # Copyright (c) 2013, Seth Chisamore
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- module VagrantPlugins
18
- module PuppetInstall
19
- module Action
20
- # @author Seth Chisamore <schisamo@opscode.com>
21
- #
22
- # This action will extract the installed version of Puppet installed on the
23
- # guest. The resulting version will exist in the `:installed_puppet_version`
24
- # key in the environment.
25
- class ReadPuppetVersion
26
- def initialize(app, env)
27
- @app = app
28
- end
29
-
30
- def call(env)
31
- env[:installed_puppet_version] = nil
32
- env[:machine].communicate.tap do |comm|
33
- # Execute it with sudo
34
- comm.sudo(puppet_version_command) do |type, data|
35
- if [:stderr, :stdout].include?(type)
36
- env[:installed_puppet_version] = data.chomp
37
- end
38
- end
39
- end
40
- @app.call(env)
41
- end
42
-
43
- private
44
-
45
- def puppet_version_command
46
- <<-PUPPET_VERSION
47
- echo $(puppet --version || "")
48
- PUPPET_VERSION
49
- end
50
- end
51
- end
52
- end
53
- end