vagrant-omnibus 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzQxYmJiN2Q2YzI1NGYyMTg4Njk5NmEyNzMwNmZiOTlmMGMyY2QzNw==
5
+ data.tar.gz: !binary |-
6
+ NzVlNTBhMmI0ZGI0ODkyYzc0MjA3YzA2NDdiNGQ2NWJjZjAzMTUyYg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MDEyMTRjZDlmMzQ4YWQ5MGZiMzliMjk4Mzk5NzQ0NzhhNGI3Yzc3YmU1ZDZi
10
+ MmQ2MWIxNDM2NjI0M2Q0YjcxZjE3NDNlMGY5N2Q5ZDE1NTRmNTQwNjIzNTEy
11
+ MWU3ZDA5MjdhODEzMjQwNTcxMTFjN2VlZGM1ZTA4ZDE2NGVmOWM=
12
+ data.tar.gz: !binary |-
13
+ YjQ4NWI5NTQwMzc2MmE4YjA0ZTQ5NjI0OTg0ZDBlYzNmZjViMmI1NGJhZGU1
14
+ ZTM2OGE2MzMzZGQ1ZDc5YzI1YjgxMjFjZTljZTI4NGU2NjM0NjUxY2Y3YTZm
15
+ MGU3OThiMWY1MjFhNzY0ZDk4YjNmOTA3Zjg5NGY2OWJmNTkwMDk=
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --default_path test/unit
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ script: rake test:unit
@@ -1,3 +1,20 @@
1
+ ## 1.0.2 (April 20, 2013)
2
+
3
+ IMPROVEMENTS:
4
+
5
+ * unit test coverage for `VagrantPlugins::Omnibus::Config`
6
+ * Add Rackspace provider acceptance test.
7
+ * Parameterize the acceptance test Rake task, this allows you test run
8
+ acceptance tests against a single provider.
9
+
10
+ BUG FIXES:
11
+
12
+ * convert `Gem::Version` returned by `#retrieve_latest_chef_version` to a
13
+ string. fixes [GH-2] for realz.
14
+ * RubyGems 2.0 compat: use #empty? to check for results. fixes [GH-6]
15
+ * Ensure 'vagrant-rackspace/action' is loaded. fixes [GH-7]
16
+ * Trigger plugin if machine state is `:active`. fixes [GH-8]
17
+
1
18
  ## 1.0.1 (April 17, 2013)
2
19
 
3
20
  IMPROVEMENTS:
data/Gemfile CHANGED
@@ -10,7 +10,8 @@ group :development do
10
10
  end
11
11
 
12
12
  group :test do
13
- gem "vagrant-aws", "~> 0.2.1"
13
+ gem "vagrant-aws", "~> 0.2.2"
14
+ gem "vagrant-rackspace", "~> 0.1.1"
14
15
  end
15
16
 
16
17
  group :docs do
data/README.md CHANGED
@@ -1,9 +1,24 @@
1
1
  # vagrant-omnibus
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/vagrant-omnibus.png)](https://badge.fury.io/rb/vagrant-omnibus.png)
4
+ [![Build Status](https://travis-ci.org/schisamo/vagrant-omnibus.png?branch=master)](https://travis-ci.org/schisamo/vagrant-omnibus)
5
+ [![Dependency Status](https://gemnasium.com/schisamo/vagrant-omnibus.png)](https://gemnasium.com/schisamo/vagrant-omnibus)
6
+ [![Code Climate](https://codeclimate.com/github/schisamo/vagrant-omnibus.png)](https://codeclimate.com/github/schisamo/vagrant-omnibus)
7
+
3
8
  A Vagrant plugin that ensures the desired version of Chef is installed via the
4
9
  platform-specific Omnibus packages. This proves very useful when using Vagrant
5
10
  with provisioner-less baseboxes OR cloud images.
6
11
 
12
+ This plugin has been verified to work with the following
13
+ [Vagrant providers](http://docs.vagrantup.com/v2/providers/index.html):
14
+
15
+ * VirtualBox (part of core)
16
+ * AWS (ships in [vagrant-aws](https://github.com/mitchellh/vagrant-aws) plugin)
17
+ * Rackspace (ships in [vagrant-rackspace](https://github.com/mitchellh/vagrant-rackspace)
18
+ plugin)
19
+
20
+ It may work with other Vagrant providers but is not guaranteed to!
21
+
7
22
  ## Installation
8
23
 
9
24
  Ensure you have downloaded and installed Vagrant 1.1.x from the
@@ -50,7 +65,13 @@ end
50
65
 
51
66
  ### Unit
52
67
 
53
- Coming soon!
68
+ The unit tests can be run with:
69
+
70
+ ```
71
+ rake test:unit
72
+ ```
73
+
74
+ The test are also executed by Travis CI every time code is pushed to GitHub.
54
75
 
55
76
  ### Acceptance
56
77
 
@@ -60,12 +81,8 @@ Currently this repo ships with a set of basic acceptance tests that will:
60
81
  * Attempt to install Chef 11.4.0 using this plugin.
61
82
  * Perform a very basic chef-solo run to ensure Chef is in fact installed.
62
83
 
63
- The acceptance tests are run with the following Vagrant providers:
64
-
65
- * VirtualBox (part of core)
66
- * AWS (ships in [vagrant-aws](https://github.com/mitchellh/vagrant-aws) plugin)
67
-
68
- The acceptance tests can be run with:
84
+ The acceptance tests are run against the Vagrant providers mentioned above. The
85
+ acceptance tests can be run with:
69
86
 
70
87
  ```
71
88
  rake test:acceptance
data/Rakefile CHANGED
@@ -8,21 +8,30 @@ YARD::Rake::YardocTask.new
8
8
  namespace :test do
9
9
 
10
10
  RSpec::Core::RakeTask.new(:unit) do |t|
11
- t.pattern = "test/unit/**/*_test.rb"
11
+ t.pattern = "test/unit/**/*_spec.rb"
12
12
  end
13
13
 
14
14
  desc "Run acceptance tests..these actually launch Vagrant sessions."
15
- task :acceptance do
15
+ task :acceptance, :provider do |t, args|
16
16
 
17
- # ensure AWS dummy box is installed
18
- unless system("vagrant box list | grep dummy &>/dev/null")
19
- system("vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box")
17
+ # ensure all required dummy boxen are installed
18
+ %w{ aws rackspace }.each do |provider|
19
+ unless system("vagrant box list | grep 'dummy\s*(#{provider})' &>/dev/null")
20
+ system("vagrant box add dummy https://github.com/mitchellh/vagrant-#{provider}/raw/master/dummy.box")
21
+ end
20
22
  end
21
23
 
22
- Dir["test/acceptance/*"].each do |provider_test_dir|
24
+ all_providers = Dir["test/acceptance/*"].map{|dir| File.basename(File.expand_path(dir))}
23
25
 
24
- provider = File.basename(File.expand_path(provider_test_dir))
26
+ # If a provider wasn't passed to the task run acceptance tests against
27
+ # ALL THE PROVIDERS!
28
+ providers = if args[:provider] && all_providers.include?(args[:provider])
29
+ [args[:provider]]
30
+ else
31
+ all_providers
32
+ end
25
33
 
34
+ providers.each do |provider|
26
35
  puts "=================================================================="
27
36
  puts "Running acceptance tests against '#{provider}' provider..."
28
37
  puts "=================================================================="
@@ -20,7 +20,7 @@ module VagrantPlugins
20
20
  module Omnibus
21
21
  module Action
22
22
  autoload :InstallChef, File.expand_path("../action/install_chef", __FILE__)
23
- autoload :IsRunning, File.expand_path("../action/is_running", __FILE__)
23
+ autoload :IsRunningOrActive, File.expand_path("../action/is_running_or_active", __FILE__)
24
24
  autoload :ReadChefVersion, File.expand_path("../action/read_chef_version", __FILE__)
25
25
 
26
26
  # Include the built-in modules so that we can use them as top-level
@@ -31,7 +31,7 @@ module VagrantPlugins
31
31
  def self.install_chef
32
32
  @install_chef ||= ::Vagrant::Action::Builder.new.tap do |b|
33
33
  b.use ConfigValidate
34
- b.use Call, IsRunning do |env1, b2|
34
+ b.use Call, IsRunningOrActive do |env1, b2|
35
35
  if env1[:result]
36
36
  b2.use ReadChefVersion
37
37
  b2.use InstallChef
@@ -17,24 +17,25 @@
17
17
  module VagrantPlugins
18
18
  module Omnibus
19
19
  module Action
20
- # @author Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
21
20
  # @author Seth Chisamore <schisamo@opscode.com>
22
21
  #
23
- # This action checks if the machine is up and running.
22
+ # This action checks if the machine is running (virtualbox) or active
23
+ # (aws, rackspace).
24
24
  #
25
- # This is a direct copy of
26
- # `VagrantPlugins::ProviderVirtualBox::Action::IsRunning` that is part of
27
- # the VirtualBox provider that ships in core Vagrant.
28
- #
29
- # @todo find out why this isn't part of `Vagrant::Action::Builtin`
30
- class IsRunning
25
+ class IsRunningOrActive
31
26
  def initialize(app, env)
32
27
  @app = app
33
28
  end
34
29
 
35
30
  def call(env)
36
- # Set the result to be true if the machine is running.
37
- env[:result] = env[:machine].state.id == :running
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
38
39
 
39
40
  # Call the next if we have one (but we shouldn't, since this
40
41
  # middleware is built to run with the Call-type middlewares)
@@ -56,8 +56,6 @@ module VagrantPlugins
56
56
 
57
57
  # Query RubyGems.org's Ruby API and retrive the latest version of Chef.
58
58
  def retrieve_latest_chef_version
59
- latest_version = nil
60
-
61
59
  available_gems = dependency_installer.find_gems_with_sources(chef_gem_dependency)
62
60
  spec, source = if available_gems.respond_to?(:last)
63
61
  # DependencyInstaller sorts the results such that the last one is
@@ -72,9 +70,7 @@ module VagrantPlugins
72
70
  best_gem && [best_gem.spec, best_gem.source]
73
71
  end
74
72
 
75
- latest_version = spec && spec.version
76
-
77
- latest_version
73
+ spec && spec.version.to_s
78
74
  end
79
75
 
80
76
  # Query RubyGems.org's Ruby API to see if the user-provided Chef version
@@ -83,7 +79,7 @@ module VagrantPlugins
83
79
  is_valid = false
84
80
  begin
85
81
  available = dependency_installer.find_gems_with_sources(chef_gem_dependency(version))
86
- is_valid = true if available.any?
82
+ is_valid = true unless available.empty?
87
83
  rescue
88
84
  end
89
85
  is_valid
@@ -54,6 +54,10 @@ module VagrantPlugins
54
54
  end
55
55
 
56
56
  if VagrantPlugins.const_defined?("Rackspace")
57
+ # The `VagrantPlugins::Rackspace` module is missing the autoload for
58
+ # `VagrantPlugins::Rackspace::Action` so we need to ensure it is
59
+ # loaded before accessing the module in the after hook below.
60
+ require 'vagrant-rackspace/action'
57
61
  hook.after(VagrantPlugins::Rackspace::Action::CreateServer, Action.install_chef)
58
62
  end
59
63
 
@@ -16,6 +16,6 @@
16
16
 
17
17
  module VagrantPlugins
18
18
  module Omnibus
19
- VERSION = "1.0.1"
19
+ VERSION = "1.0.2"
20
20
  end
21
21
  end
@@ -0,0 +1,27 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # plugins don't seem to be auto-loaded from the bundle
5
+ require 'vagrant-omnibus'
6
+ require 'vagrant-rackspace'
7
+
8
+ Vagrant.configure("2") do |config|
9
+ config.omnibus.chef_version = '11.4.0'
10
+
11
+ config.vm.box = "dummy"
12
+ config.vm.provider :rackspace do |rackspace|
13
+ rackspace.username = ENV['DEV_RACKSPACE_USERNAME']
14
+ rackspace.api_key = ENV['DEV_RACKSPACE_API_KEY']
15
+ rackspace.flavor = /512MB/
16
+ rackspace.image = /Ubuntu 12.04/
17
+ rackspace.public_key_path = "~/.ssh/id_rsa.pub"
18
+ # TODO - switch this to the `override.ssh.private_key_path` syntax once
19
+ # `vagrant-rackspace` is updated.
20
+ config.ssh.private_key_path = "~/.ssh/id_rsa"
21
+ end
22
+
23
+ config.vm.provision :chef_solo do |chef|
24
+ chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
25
+ chef.add_recipe "chef-inator"
26
+ end
27
+ end
@@ -1,7 +1,11 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
2
+
3
+ require 'rspec/core'
2
4
  require 'vagrant-omnibus'
3
5
 
4
6
  RSpec.configure do |config|
7
+ config.formatter = :documentation
8
+
5
9
  # a little syntactic sugar
6
10
  config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
7
11
 
@@ -0,0 +1,71 @@
1
+ # We have to use `require_relative` until RSpec 2.14.0. As non-standard RSpec
2
+ # default paths are not on the $LOAD_PATH.
3
+ #
4
+ # More info here:
5
+ # https://github.com/rspec/rspec-core/pull/831
6
+ #
7
+ require_relative '../spec_helper'
8
+
9
+ describe VagrantPlugins::Omnibus::Config do
10
+ let(:instance){ described_class.new }
11
+
12
+ subject(:config) do
13
+ instance.tap do |o|
14
+ o.chef_version = chef_version if defined?(chef_version)
15
+ o.finalize!
16
+ end
17
+ end
18
+
19
+ describe "defaults" do
20
+ its(:chef_version){ should be_nil }
21
+ end
22
+
23
+ describe "resolving `:latest` to a real Chef version" do
24
+ let(:chef_version) { :latest }
25
+ its(:chef_version){ should be_a(String) }
26
+ its(:chef_version){ should match(/\d*\.\d*\.\d*/) }
27
+ end
28
+
29
+ describe "#validate" do
30
+ let(:machine) { double('machine') }
31
+ let(:error_hash_key) { "Omnibus Plugin" }
32
+ let(:result) { subject.validate(machine) }
33
+ let(:errors) { result[error_hash_key] }
34
+
35
+ it "returns a Hash with an 'Omnibus Plugin' key" do
36
+ result.should be_a(Hash)
37
+ result.should have_key(error_hash_key)
38
+ end
39
+
40
+ describe "chef_version validation" do
41
+ {
42
+ "11.4.0" => {
43
+ :description => "valid Chef version string",
44
+ :valid => true
45
+ },
46
+ "10.99.99" => {
47
+ :description => "invalid Chef version string",
48
+ :valid => false
49
+ },
50
+ "FUFUFU" => {
51
+ :description => "invalid RubyGems version string",
52
+ :valid => false
53
+ }
54
+ }.each_pair do |version_string, opts|
55
+ context "#{opts[:description]}: #{version_string}" do
56
+ let(:chef_version) { version_string }
57
+ if opts[:valid]
58
+ it "passes" do
59
+ errors.should be_empty
60
+ end
61
+ else
62
+ it "fails" do
63
+ errors.should_not be_empty
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end # describe chef_version
69
+ end # describe #validate
70
+
71
+ end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-omnibus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Seth Chisamore
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-18 00:00:00.000000000 Z
11
+ date: 2013-04-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -68,6 +61,8 @@ extensions: []
68
61
  extra_rdoc_files: []
69
62
  files:
70
63
  - .gitignore
64
+ - .rspec
65
+ - .travis.yml
71
66
  - .yardopts
72
67
  - CHANGELOG.md
73
68
  - Gemfile
@@ -78,55 +73,52 @@ files:
78
73
  - lib/vagrant-omnibus.rb
79
74
  - lib/vagrant-omnibus/action.rb
80
75
  - lib/vagrant-omnibus/action/install_chef.rb
81
- - lib/vagrant-omnibus/action/is_running.rb
76
+ - lib/vagrant-omnibus/action/is_running_or_active.rb
82
77
  - lib/vagrant-omnibus/action/read_chef_version.rb
83
78
  - lib/vagrant-omnibus/config.rb
84
79
  - lib/vagrant-omnibus/plugin.rb
85
80
  - lib/vagrant-omnibus/version.rb
86
81
  - test/acceptance/aws/Vagrantfile
82
+ - test/acceptance/rackspace/Vagrantfile
87
83
  - test/acceptance/virtualbox/Vagrantfile
88
84
  - test/support/cookbooks/chef-inator/README.md
89
85
  - test/support/cookbooks/chef-inator/metadata.rb
90
86
  - test/support/cookbooks/chef-inator/recipes/default.rb
91
87
  - test/unit/spec_helper.rb
88
+ - test/unit/vagrant-omnibus/config_spec.rb
92
89
  - vagrant-omnibus.gemspec
93
90
  homepage: https://github.com/schisamo/vagrant-omnibus
94
91
  licenses:
95
92
  - Apache 2.0
93
+ metadata: {}
96
94
  post_install_message:
97
95
  rdoc_options: []
98
96
  require_paths:
99
97
  - lib
100
98
  required_ruby_version: !ruby/object:Gem::Requirement
101
- none: false
102
99
  requirements:
103
100
  - - ! '>='
104
101
  - !ruby/object:Gem::Version
105
102
  version: '0'
106
- segments:
107
- - 0
108
- hash: 4157044692282248393
109
103
  required_rubygems_version: !ruby/object:Gem::Requirement
110
- none: false
111
104
  requirements:
112
105
  - - ! '>='
113
106
  - !ruby/object:Gem::Version
114
107
  version: '0'
115
- segments:
116
- - 0
117
- hash: 4157044692282248393
118
108
  requirements: []
119
109
  rubyforge_project:
120
- rubygems_version: 1.8.25
110
+ rubygems_version: 2.0.3
121
111
  signing_key:
122
- specification_version: 3
112
+ specification_version: 4
123
113
  summary: A Vagrant plugin that ensures the desired version of Chef is installed via
124
114
  the platform-specific Omnibus packages.
125
115
  test_files:
126
116
  - test/acceptance/aws/Vagrantfile
117
+ - test/acceptance/rackspace/Vagrantfile
127
118
  - test/acceptance/virtualbox/Vagrantfile
128
119
  - test/support/cookbooks/chef-inator/README.md
129
120
  - test/support/cookbooks/chef-inator/metadata.rb
130
121
  - test/support/cookbooks/chef-inator/recipes/default.rb
131
122
  - test/unit/spec_helper.rb
123
+ - test/unit/vagrant-omnibus/config_spec.rb
132
124
  has_rdoc: