vagrant-omnibus 1.0.0 → 1.0.1
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.
- data/CHANGELOG.md +19 -1
- data/Gemfile +2 -2
- data/TODO.md +0 -2
- data/lib/vagrant-omnibus.rb +16 -0
- data/lib/vagrant-omnibus/action.rb +16 -0
- data/lib/vagrant-omnibus/action/install_chef.rb +19 -2
- data/lib/vagrant-omnibus/action/is_running.rb +16 -0
- data/lib/vagrant-omnibus/action/read_chef_version.rb +16 -0
- data/lib/vagrant-omnibus/config.rb +82 -2
- data/lib/vagrant-omnibus/plugin.rb +16 -0
- data/lib/vagrant-omnibus/version.rb +16 -1
- data/test/acceptance/aws/Vagrantfile +6 -4
- data/test/acceptance/virtualbox/Vagrantfile +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
-
## 1.0.
|
1
|
+
## 1.0.1 (April 17, 2013)
|
2
|
+
|
3
|
+
IMPROVEMENTS:
|
4
|
+
|
5
|
+
* Resolve `latest` to a real Chef version. This ensures the plugin does not
|
6
|
+
attempt to re-install Chef on subsequent provisions. [GH-2]
|
7
|
+
* Validate user provided value for omnibus.chef_version is in fact a real Chef
|
8
|
+
version. [GH-4]
|
9
|
+
* Retrieve omnibus.chef_version directly from global config.
|
10
|
+
* Update development depdendencies to vagrant (1.2.1) and vagrant-aws
|
11
|
+
(0.2.1).
|
12
|
+
|
13
|
+
BUG FIXES:
|
14
|
+
|
15
|
+
* Plugin now correctly operates in "no-op" node if now "omnibus.chef_version"
|
16
|
+
is not present in the Vagrantfile. [GH-3]
|
17
|
+
* Use Ubuntu 12.04 release AMI for acceptance testing.
|
18
|
+
|
19
|
+
## 1.0.0 (April 1, 2013)
|
2
20
|
|
3
21
|
* The initial release.
|
data/Gemfile
CHANGED
@@ -6,11 +6,11 @@ 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.1
|
9
|
+
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => "v1.2.1"
|
10
10
|
end
|
11
11
|
|
12
12
|
group :test do
|
13
|
-
gem "vagrant-aws", "~> 0.1
|
13
|
+
gem "vagrant-aws", "~> 0.2.1"
|
14
14
|
end
|
15
15
|
|
16
16
|
group :docs do
|
data/TODO.md
CHANGED
data/lib/vagrant-omnibus.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
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
|
+
|
1
17
|
require "pathname"
|
2
18
|
require "vagrant-omnibus/plugin"
|
3
19
|
|
@@ -1,3 +1,19 @@
|
|
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
|
+
|
1
17
|
require "vagrant/action/builder"
|
2
18
|
|
3
19
|
module VagrantPlugins
|
@@ -1,3 +1,19 @@
|
|
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
|
+
|
1
17
|
module VagrantPlugins
|
2
18
|
module Omnibus
|
3
19
|
module Action
|
@@ -12,11 +28,11 @@ module VagrantPlugins
|
|
12
28
|
@app = app
|
13
29
|
# Config#finalize! SHOULD be called automatically
|
14
30
|
env[:global_config].omnibus.finalize!
|
15
|
-
env["omnibus.desired_chef_version"] ||= env[:global_config].omnibus.chef_version
|
16
31
|
end
|
17
32
|
|
18
33
|
def call(env)
|
19
|
-
desired_chef_version = env[
|
34
|
+
desired_chef_version = env[:global_config].omnibus.chef_version
|
35
|
+
|
20
36
|
unless desired_chef_version.nil?
|
21
37
|
env[:ui].info("Ensuring Chef is installed at requested version of #{desired_chef_version}.")
|
22
38
|
if env[:installed_chef_version] == desired_chef_version
|
@@ -26,6 +42,7 @@ module VagrantPlugins
|
|
26
42
|
env[:ssh_run_command] = install_chef_command(desired_chef_version)
|
27
43
|
end
|
28
44
|
end
|
45
|
+
|
29
46
|
@app.call(env)
|
30
47
|
end
|
31
48
|
|
@@ -1,3 +1,19 @@
|
|
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
|
+
|
1
17
|
module VagrantPlugins
|
2
18
|
module Omnibus
|
3
19
|
module Action
|
@@ -1,3 +1,19 @@
|
|
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
|
+
|
1
17
|
module VagrantPlugins
|
2
18
|
module Omnibus
|
3
19
|
module Action
|
@@ -1,4 +1,22 @@
|
|
1
|
-
|
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 'rubygems/dependency'
|
18
|
+
require 'rubygems/dependency_installer'
|
19
|
+
require 'vagrant'
|
2
20
|
|
3
21
|
module VagrantPlugins
|
4
22
|
module Omnibus
|
@@ -14,7 +32,69 @@ module VagrantPlugins
|
|
14
32
|
end
|
15
33
|
|
16
34
|
def finalize!
|
17
|
-
|
35
|
+
if @chef_version == UNSET_VALUE
|
36
|
+
@chef_version = nil
|
37
|
+
elsif @chef_version.to_s == 'latest'
|
38
|
+
# resolve `latest` to a real version
|
39
|
+
@chef_version = retrieve_latest_chef_version
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def validate(machine)
|
44
|
+
errors = []
|
45
|
+
|
46
|
+
unless valid_chef_version?(chef_version)
|
47
|
+
msg = "'#{chef_version}' is not a valid version of Chef."
|
48
|
+
msg << "\n\n A list of valid versions can be found at: http://www.opscode.com/chef/install/"
|
49
|
+
errors << msg
|
50
|
+
end
|
51
|
+
|
52
|
+
{ "Omnibus Plugin" => errors }
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
# Query RubyGems.org's Ruby API and retrive the latest version of Chef.
|
58
|
+
def retrieve_latest_chef_version
|
59
|
+
latest_version = nil
|
60
|
+
|
61
|
+
available_gems = dependency_installer.find_gems_with_sources(chef_gem_dependency)
|
62
|
+
spec, source = if available_gems.respond_to?(:last)
|
63
|
+
# DependencyInstaller sorts the results such that the last one is
|
64
|
+
# always the one it considers best.
|
65
|
+
spec_with_source = available_gems.last
|
66
|
+
spec_with_source
|
67
|
+
else
|
68
|
+
# Rubygems 2.0 returns a Gem::Available set, which is a
|
69
|
+
# collection of AvailableSet::Tuple structs
|
70
|
+
available_gems.pick_best!
|
71
|
+
best_gem = available_gems.set.first
|
72
|
+
best_gem && [best_gem.spec, best_gem.source]
|
73
|
+
end
|
74
|
+
|
75
|
+
latest_version = spec && spec.version
|
76
|
+
|
77
|
+
latest_version
|
78
|
+
end
|
79
|
+
|
80
|
+
# Query RubyGems.org's Ruby API to see if the user-provided Chef version
|
81
|
+
# is in fact a real Chef version!
|
82
|
+
def valid_chef_version?(version)
|
83
|
+
is_valid = false
|
84
|
+
begin
|
85
|
+
available = dependency_installer.find_gems_with_sources(chef_gem_dependency(version))
|
86
|
+
is_valid = true if available.any?
|
87
|
+
rescue
|
88
|
+
end
|
89
|
+
is_valid
|
90
|
+
end
|
91
|
+
|
92
|
+
def dependency_installer
|
93
|
+
@dependency_installer ||= Gem::DependencyInstaller.new
|
94
|
+
end
|
95
|
+
|
96
|
+
def chef_gem_dependency(version=nil)
|
97
|
+
Gem::Dependency.new('chef', version)
|
18
98
|
end
|
19
99
|
end
|
20
100
|
end
|
@@ -1,3 +1,19 @@
|
|
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
|
+
|
1
17
|
begin
|
2
18
|
require "vagrant"
|
3
19
|
rescue LoadError
|
@@ -1,6 +1,21 @@
|
|
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
|
+
#
|
1
16
|
|
2
17
|
module VagrantPlugins
|
3
18
|
module Omnibus
|
4
|
-
VERSION = "1.0.
|
19
|
+
VERSION = "1.0.1"
|
5
20
|
end
|
6
21
|
end
|
@@ -9,15 +9,17 @@ Vagrant.configure("2") do |config|
|
|
9
9
|
config.omnibus.chef_version = '11.4.0'
|
10
10
|
|
11
11
|
config.vm.box = "dummy"
|
12
|
-
config.vm.provider :aws do |aws|
|
12
|
+
config.vm.provider :aws do |aws, override|
|
13
13
|
aws.access_key_id = ENV['DEV_AWS_ACCESS_KEY_ID']
|
14
14
|
aws.secret_access_key = ENV['DEV_AWS_SECRET_ACCESS_KEY']
|
15
15
|
aws.keypair_name = ENV['USER']
|
16
|
-
aws.ssh_private_key_path = "~/.ssh/id_rsa"
|
17
16
|
|
18
|
-
aws.
|
17
|
+
aws.instance_type = "m1.large"
|
18
|
+
aws.ami = "ami-2efa9d47" # Ubuntu 12.04 LTS 64-bit instance root store
|
19
19
|
aws.ssh_username = "ubuntu"
|
20
|
-
|
20
|
+
|
21
|
+
override.ssh.username = "ubuntu"
|
22
|
+
override.ssh.private_key_path = "~/.ssh/id_rsa"
|
21
23
|
end
|
22
24
|
|
23
25
|
config.vm.provision :chef_solo do |chef|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'vagrant-omnibus'
|
6
6
|
|
7
7
|
Vagrant.configure("2") do |config|
|
8
|
-
config.omnibus.chef_version =
|
8
|
+
config.omnibus.chef_version = :latest
|
9
9
|
|
10
10
|
config.vm.box = "canonical-ubuntu-12.04"
|
11
11
|
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-omnibus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -105,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
segments:
|
107
107
|
- 0
|
108
|
-
hash:
|
108
|
+
hash: 4157044692282248393
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
none: false
|
111
111
|
requirements:
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
segments:
|
116
116
|
- 0
|
117
|
-
hash:
|
117
|
+
hash: 4157044692282248393
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
120
|
rubygems_version: 1.8.25
|