vagrant-omnibus 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rubocop.yml +3 -1
- data/.travis.yml +2 -2
- data/CHANGELOG.md +24 -2
- data/Gemfile +8 -7
- data/README.md +4 -4
- data/Rakefile +59 -30
- data/lib/vagrant-omnibus/action/install_chef.rb +90 -42
- data/lib/vagrant-omnibus/config.rb +19 -3
- data/lib/vagrant-omnibus/version.rb +1 -1
- data/test/acceptance/aws/Vagrantfile +10 -9
- data/test/acceptance/digital_ocean/Vagrantfile +4 -3
- data/test/acceptance/rackspace/Vagrantfile +8 -7
- data/test/acceptance/virtualbox/Vagrantfile +33 -11
- data/test/unit/vagrant-omnibus/config_spec.rb +10 -11
- data/vagrant-omnibus.gemspec +16 -14
- metadata +8 -8
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,24 @@
|
|
1
|
+
## 1.3.0 (February 24, 2014)
|
2
|
+
|
3
|
+
FEATURES:
|
4
|
+
|
5
|
+
* PR [#59][], PR [#60][]: Windows guest support! ([@jarig][])([@schisamo][])
|
6
|
+
|
7
|
+
IMPROVEMENTS:
|
8
|
+
|
9
|
+
* PR [#61][]: Make detection of currently installed Chef version more robust. ([@ampedandwired][])
|
10
|
+
* Create explicit tasks for supported provider acceptance tests. ([@schisamo][])
|
11
|
+
* Add Ruby 2.1.0 to the Travis CI test matrix. ([@schisamo][])
|
12
|
+
|
13
|
+
BUG FIXES:
|
14
|
+
|
15
|
+
* Issue [#13][]: Perform config validation at action execution time. ([@schisamo][])
|
16
|
+
|
1
17
|
## 1.2.1 (December 17, 2013)
|
2
18
|
|
3
19
|
IMPROVEMENTS:
|
4
20
|
|
5
|
-
* Acceptance test coverage that verifies Chef is not reinstalled into a system where the desired version of Chef already exists.
|
21
|
+
* Acceptance test coverage that verifies Chef is not reinstalled into a system where the desired version of Chef already exists. ([@schisamo][])
|
6
22
|
|
7
23
|
BUG FIXES:
|
8
24
|
|
@@ -18,7 +34,7 @@ IMPROVEMENTS:
|
|
18
34
|
|
19
35
|
* PR [#48][]: Don't install Chef if `--no-provision` is specified. ([@tmatilai][])
|
20
36
|
* PR [#50][]: Update README.md with vagrant-parallels compatibility. ([@wizonesolutions][])
|
21
|
-
* PR [#56][]: Add Rubocop support.
|
37
|
+
* PR [#56][]: Add Rubocop support and fix style errors. ([@schisamo][])
|
22
38
|
|
23
39
|
BUG FIXES:
|
24
40
|
|
@@ -100,6 +116,7 @@ BUG FIXES:
|
|
100
116
|
[#8]: https://github.com/schisamo/vagrant-omnibus/issues/8
|
101
117
|
[#10]: https://github.com/schisamo/vagrant-omnibus/issues/10
|
102
118
|
[#12]: https://github.com/schisamo/vagrant-omnibus/issues/12
|
119
|
+
[#13]: https://github.com/schisamo/vagrant-omnibus/issues/13
|
103
120
|
[#15]: https://github.com/schisamo/vagrant-omnibus/issues/15
|
104
121
|
[#17]: https://github.com/schisamo/vagrant-omnibus/issues/17
|
105
122
|
[#19]: https://github.com/schisamo/vagrant-omnibus/issues/19
|
@@ -121,7 +138,12 @@ BUG FIXES:
|
|
121
138
|
[#53]: https://github.com/schisamo/vagrant-omnibus/issues/53
|
122
139
|
[#56]: https://github.com/schisamo/vagrant-omnibus/issues/56
|
123
140
|
[#57]: https://github.com/schisamo/vagrant-omnibus/issues/57
|
141
|
+
[#59]: https://github.com/schisamo/vagrant-omnibus/issues/59
|
142
|
+
[#60]: https://github.com/schisamo/vagrant-omnibus/issues/60
|
143
|
+
[#61]: https://github.com/schisamo/vagrant-omnibus/issues/61
|
144
|
+
[@ampedandwired]: https://github.com/ampedandwired
|
124
145
|
[@comutt]: https://github.com/comutt
|
146
|
+
[@jarig]: https://github.com/jarig
|
125
147
|
[@matsu911]: https://github.com/matsu911
|
126
148
|
[@michfield]: https://github.com/michfield
|
127
149
|
[@petecheslock]: https://github.com/petecheslock
|
data/Gemfile
CHANGED
@@ -6,17 +6,18 @@ 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
|
9
|
+
gem 'vagrant', git: 'git://github.com/mitchellh/vagrant.git', tag: 'v1.4.3'
|
10
|
+
gem 'vagrant-windows', '~> 1.5'
|
10
11
|
end
|
11
12
|
|
12
13
|
group :acceptance do
|
13
|
-
gem
|
14
|
-
gem
|
15
|
-
gem
|
14
|
+
gem 'vagrant-digitalocean', '~> 0.5'
|
15
|
+
gem 'vagrant-aws', '~> 0.4'
|
16
|
+
gem 'vagrant-rackspace', '~> 0.1'
|
16
17
|
end
|
17
18
|
|
18
19
|
group :docs do
|
19
|
-
gem
|
20
|
-
gem
|
21
|
-
gem
|
20
|
+
gem 'yard', '~> 0.8'
|
21
|
+
gem 'redcarpet', '~> 2.2'
|
22
|
+
gem 'github-markup', '~> 0.7'
|
22
23
|
end
|
data/README.md
CHANGED
@@ -112,14 +112,14 @@ The test are also executed by Travis CI every time code is pushed to GitHub.
|
|
112
112
|
Currently this repo ships with a set of basic acceptance tests that will:
|
113
113
|
|
114
114
|
* Provision a Vagrant instance.
|
115
|
-
* Attempt to install Chef
|
115
|
+
* Attempt to install Chef using this plugin.
|
116
116
|
* Perform a very basic chef-solo run to ensure Chef is in fact installed.
|
117
117
|
|
118
|
-
The acceptance tests
|
119
|
-
acceptance tests can be run with:
|
118
|
+
The acceptance tests can be run against a subset of the Vagrant providers
|
119
|
+
listed above. The acceptance tests can be run with:
|
120
120
|
|
121
121
|
```
|
122
|
-
rake test:acceptance
|
122
|
+
rake test:acceptance:PROVIDER_NAME
|
123
123
|
```
|
124
124
|
|
125
125
|
And as expected, all acceptance tests only uses provisioner-less baseboxes and
|
data/Rakefile
CHANGED
@@ -4,49 +4,78 @@ require 'rspec/core/rake_task'
|
|
4
4
|
require 'rubocop/rake_task'
|
5
5
|
require 'yard'
|
6
6
|
|
7
|
-
|
7
|
+
# rubocop:disable LineLength
|
8
|
+
|
9
|
+
def run_acceptance_tests(provider = 'virtualbox')
|
10
|
+
puts '=================================================================='
|
11
|
+
puts "Running acceptance tests against '#{provider}' provider..."
|
12
|
+
puts '=================================================================='
|
13
|
+
|
14
|
+
Dir.chdir("test/acceptance/#{provider}") do
|
15
|
+
system('vagrant destroy -f')
|
16
|
+
system("vagrant up --provider=#{provider}")
|
17
|
+
system('vagrant destroy -f')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
8
21
|
YARD::Rake::YardocTask.new
|
9
22
|
|
23
|
+
namespace :style do
|
24
|
+
require 'rubocop/rake_task'
|
25
|
+
desc 'Run Ruby style checks'
|
26
|
+
Rubocop::RakeTask.new(:ruby) do |task|
|
27
|
+
task.patterns = [
|
28
|
+
'**/*.rb',
|
29
|
+
'**/Vagrantfile',
|
30
|
+
'*.gemspec',
|
31
|
+
'Gemfile',
|
32
|
+
'Rakefile'
|
33
|
+
]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
10
37
|
namespace :test do
|
11
38
|
|
12
39
|
RSpec::Core::RakeTask.new(:unit) do |t|
|
13
|
-
t.pattern =
|
40
|
+
t.pattern = 'test/unit/**/*_spec.rb'
|
14
41
|
end
|
15
42
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
unless system("vagrant box list | grep 'dummy\s*(#{provider})' &>/dev/null")
|
22
|
-
system("vagrant box add dummy https://github.com/mitchellh/vagrant-#{provider}/raw/master/dummy.box")
|
43
|
+
namespace :acceptance do
|
44
|
+
desc 'Run acceptance tests with AWS provider'
|
45
|
+
task :aws do
|
46
|
+
unless system("vagrant box list | grep 'dummy\s*(aws)' &>/dev/null")
|
47
|
+
system('vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box')
|
23
48
|
end
|
49
|
+
run_acceptance_tests('aws')
|
24
50
|
end
|
25
51
|
|
26
|
-
|
27
|
-
|
52
|
+
desc 'Run acceptance tests with Digital Ocean provider'
|
53
|
+
task 'digital_ocean' do
|
54
|
+
unless system("vagrant box list | grep 'digital_ocean' &>/dev/null")
|
55
|
+
system('vagrant box add digital_ocean https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box')
|
56
|
+
end
|
28
57
|
end
|
29
58
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
providers = if args[:provider] && all_providers.include?(args[:provider])
|
35
|
-
[args[:provider]]
|
36
|
-
else
|
37
|
-
all_providers
|
38
|
-
end
|
39
|
-
|
40
|
-
providers.each do |provider|
|
41
|
-
puts "=================================================================="
|
42
|
-
puts "Running acceptance tests against '#{provider}' provider..."
|
43
|
-
puts "=================================================================="
|
44
|
-
|
45
|
-
Dir.chdir("test/acceptance/#{provider}") do
|
46
|
-
system("vagrant destroy -f")
|
47
|
-
system("vagrant up --provider=#{provider}")
|
48
|
-
system("vagrant destroy -f")
|
59
|
+
desc 'Run acceptance tests with Rackspace provider'
|
60
|
+
task :rackspace do
|
61
|
+
unless system("vagrant box list | grep 'dummy\s*(rackspace)' &>/dev/null")
|
62
|
+
system('vagrant box add dummy https://github.com/mitchellh/vagrant-rackspace/raw/master/dummy.box')
|
49
63
|
end
|
64
|
+
run_acceptance_tests('aws')
|
65
|
+
end
|
66
|
+
|
67
|
+
desc 'Run acceptance tests with VirtualBox provider'
|
68
|
+
task :virtualbox do
|
69
|
+
run_acceptance_tests('virtualbox')
|
50
70
|
end
|
51
71
|
end
|
52
72
|
end
|
73
|
+
|
74
|
+
# We cannot run Test Kitchen on Travis CI yet...
|
75
|
+
namespace :travis do
|
76
|
+
desc 'Run tests on Travis'
|
77
|
+
task ci: ['style:ruby', 'test:unit']
|
78
|
+
end
|
79
|
+
|
80
|
+
# The default rake task should just run it all
|
81
|
+
task default: ['style:ruby', 'test:unit', 'test:acceptance:virtualbox']
|
@@ -26,24 +26,21 @@ module VagrantPlugins
|
|
26
26
|
#
|
27
27
|
# This action installs Chef Omnibus packages at the desired version.
|
28
28
|
class InstallChef
|
29
|
-
INSTALL_SH = "#{ENV['OMNIBUS_INSTALL_URL'] ||
|
30
|
-
'https://www.opscode.com/chef/install.sh'}"
|
31
|
-
|
32
29
|
def initialize(app, env)
|
33
30
|
@app = app
|
34
31
|
@logger =
|
35
32
|
Log4r::Logger.new('vagrantplugins::omnibus::action::installchef')
|
36
33
|
@machine = env[:machine]
|
37
|
-
|
38
|
-
@machine.config.omnibus.finalize!
|
34
|
+
@install_script = find_install_script
|
39
35
|
end
|
40
36
|
|
41
37
|
def call(env)
|
42
38
|
@app.call(env)
|
43
39
|
|
44
|
-
return
|
45
|
-
|
46
|
-
|
40
|
+
return unless @machine.communicate.ready? && provision_enabled?(env)
|
41
|
+
|
42
|
+
# Perform delayed validation
|
43
|
+
@machine.config.omnibus.validate!(@machine)
|
47
44
|
|
48
45
|
desired_version = @machine.config.omnibus.chef_version
|
49
46
|
unless desired_version.nil?
|
@@ -53,7 +50,7 @@ module VagrantPlugins
|
|
53
50
|
version: desired_version
|
54
51
|
)
|
55
52
|
else
|
56
|
-
|
53
|
+
fetch_or_create_install_script(env)
|
57
54
|
env[:ui].info I18n.t(
|
58
55
|
'vagrant-omnibus.action.installing',
|
59
56
|
version: desired_version
|
@@ -66,8 +63,28 @@ module VagrantPlugins
|
|
66
63
|
|
67
64
|
private
|
68
65
|
|
69
|
-
|
70
|
-
|
66
|
+
# Determines what flavor of install script should be used to
|
67
|
+
# install Omnibus Chef package.
|
68
|
+
def find_install_script
|
69
|
+
if !ENV['OMNIBUS_INSTALL_URL'].nil?
|
70
|
+
ENV['OMNIBUS_INSTALL_URL']
|
71
|
+
elsif windows_guest?
|
72
|
+
'http://www.getchef.com/chef/install.msi'
|
73
|
+
else
|
74
|
+
'https://www.getchef.com/chef/install.sh'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def install_script_name
|
79
|
+
if windows_guest?
|
80
|
+
'install.bat'
|
81
|
+
else
|
82
|
+
'install.sh'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def windows_guest?
|
87
|
+
@machine.config.vm.guest.eql?(:windows)
|
71
88
|
end
|
72
89
|
|
73
90
|
def provision_enabled?(env)
|
@@ -76,26 +93,38 @@ module VagrantPlugins
|
|
76
93
|
|
77
94
|
def installed_version
|
78
95
|
version = nil
|
79
|
-
|
80
|
-
|
96
|
+
opts = nil
|
97
|
+
if windows_guest?
|
98
|
+
command = 'cmd.exe /c chef-solo -v 2>&0'
|
99
|
+
opts = { shell: :cmd, error_check: false }
|
100
|
+
else
|
101
|
+
command = 'echo $(chef-solo -v)'
|
102
|
+
end
|
103
|
+
@machine.communicate.sudo(command, opts) do |type, data|
|
81
104
|
if [:stderr, :stdout].include?(type)
|
82
|
-
|
83
|
-
|
84
|
-
version ||= v.split[1] unless v.empty?
|
105
|
+
version_match = data.match(/^Chef: (.+)/)
|
106
|
+
version = version_match.captures[0].strip if version_match
|
85
107
|
end
|
86
108
|
end
|
87
109
|
version
|
88
110
|
end
|
89
111
|
|
90
|
-
#
|
112
|
+
#
|
113
|
+
# Upload install script from Host's Vagrant TMP directory to guest
|
91
114
|
# and executes.
|
115
|
+
#
|
92
116
|
def install(version, env)
|
93
117
|
shell_escaped_version = Shellwords.escape(version)
|
94
118
|
|
95
119
|
@machine.communicate.tap do |comm|
|
96
|
-
comm.upload(@
|
97
|
-
|
98
|
-
|
120
|
+
comm.upload(@script_tmp_path, install_script_name)
|
121
|
+
if windows_guest?
|
122
|
+
install_cmd = "cmd.exe /c #{install_script_name} #{version}"
|
123
|
+
else
|
124
|
+
# TODO: Execute with `sh` once install.sh removes it's bash-isms.
|
125
|
+
install_cmd =
|
126
|
+
"bash #{install_script_name} -v #{shell_escaped_version} 2>&1"
|
127
|
+
end
|
99
128
|
comm.sudo(install_cmd) do |type, data|
|
100
129
|
if [:stderr, :stdout].include?(type)
|
101
130
|
next if data =~ /stdin: is not a tty/
|
@@ -105,18 +134,18 @@ module VagrantPlugins
|
|
105
134
|
end
|
106
135
|
end
|
107
136
|
|
108
|
-
# Fetches install.sh file to the Host's Vagrant TMP directory.
|
109
|
-
#
|
110
|
-
# Mostly lifted from:
|
111
137
|
#
|
112
|
-
#
|
138
|
+
# Fetches or creates a platform specific install script to the Host's
|
139
|
+
# Vagrant TMP directory.
|
113
140
|
#
|
114
|
-
def
|
115
|
-
@
|
116
|
-
env[:tmp_path].join(Time.now.to_i.to_s
|
117
|
-
|
141
|
+
def fetch_or_create_install_script(env)
|
142
|
+
@script_tmp_path =
|
143
|
+
env[:tmp_path].join("#{Time.now.to_i.to_s}-#{install_script_name}")
|
144
|
+
|
145
|
+
@logger.info("Generating install script at: #{@script_tmp_path}")
|
146
|
+
|
147
|
+
url = @install_script
|
118
148
|
|
119
|
-
url = INSTALL_SH
|
120
149
|
if File.file?(url) || url !~ /^[a-z0-9]+:.*$/i
|
121
150
|
@logger.info('Assuming URL is a file.')
|
122
151
|
file_path = File.expand_path(url)
|
@@ -124,18 +153,37 @@ module VagrantPlugins
|
|
124
153
|
url = "file:#{file_path}"
|
125
154
|
end
|
126
155
|
|
127
|
-
|
128
|
-
#
|
129
|
-
#
|
130
|
-
|
131
|
-
# Download the install.sh file to a temporary path. We store
|
132
|
-
# the temporary path as an instance variable so that the
|
133
|
-
# `#recover` method can access it.
|
156
|
+
# Download the install.sh or create install.bat file to a temporary
|
157
|
+
# path. We store the temporary path as an instance variable so that
|
158
|
+
# the `#recover` method can access it.
|
134
159
|
begin
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
160
|
+
if windows_guest?
|
161
|
+
# generate a install.bat file at the `@script_tmp_path` location
|
162
|
+
#
|
163
|
+
# We'll also disable Rubocop for this embedded PowerShell code:
|
164
|
+
#
|
165
|
+
# rubocop:disable LineLength, SpaceAroundBlockBraces
|
166
|
+
#
|
167
|
+
File.open(@script_tmp_path, 'w') do |f|
|
168
|
+
f.puts <<-EOH.gsub(/^\s{18}/, '')
|
169
|
+
@echo off
|
170
|
+
set version=%1
|
171
|
+
set dest=%~dp0chef-client-%version%-1.windows.msi
|
172
|
+
echo Downloading Chef %version% for Windows...
|
173
|
+
powershell -command "(New-Object System.Net.WebClient).DownloadFile('#{url}?v=%version%', '%dest%')"
|
174
|
+
echo Installing Chef %version%
|
175
|
+
msiexec /q /i %dest%
|
176
|
+
EOH
|
177
|
+
end
|
178
|
+
# rubocop:enable LineLength, SpaceAroundBlockBraces
|
179
|
+
else
|
180
|
+
downloader = Vagrant::Util::Downloader.new(
|
181
|
+
url,
|
182
|
+
@script_tmp_path,
|
183
|
+
{}
|
184
|
+
)
|
185
|
+
downloader.download!
|
186
|
+
end
|
139
187
|
rescue Vagrant::Errors::DownloaderInterrupted
|
140
188
|
# The downloader was interrupted, so just return, because that
|
141
189
|
# means we were interrupted as well.
|
@@ -145,8 +193,8 @@ module VagrantPlugins
|
|
145
193
|
end
|
146
194
|
|
147
195
|
def recover(env)
|
148
|
-
if @
|
149
|
-
File.unlink(@
|
196
|
+
if @script_tmp_path && File.exist?(@script_tmp_path)
|
197
|
+
File.unlink(@script_tmp_path)
|
150
198
|
end
|
151
199
|
end
|
152
200
|
end
|
@@ -17,6 +17,8 @@
|
|
17
17
|
require 'rubygems/dependency'
|
18
18
|
require 'rubygems/dependency_installer'
|
19
19
|
require 'vagrant'
|
20
|
+
require 'vagrant/errors'
|
21
|
+
require 'vagrant/util/template_renderer'
|
20
22
|
|
21
23
|
module VagrantPlugins
|
22
24
|
#
|
@@ -41,19 +43,33 @@ module VagrantPlugins
|
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
|
46
|
+
#
|
47
|
+
# Performs validation and immediately raises an exception for any
|
48
|
+
# detected errors.
|
49
|
+
#
|
50
|
+
# @raise [Vagrant::Errors::ConfigInvalid]
|
51
|
+
# if validation fails
|
52
|
+
#
|
53
|
+
def validate!(machine)
|
54
|
+
finalize!
|
45
55
|
errors = []
|
46
56
|
|
47
57
|
unless valid_chef_version?(chef_version)
|
48
58
|
msg = <<-EOH
|
49
|
-
'#{chef_version}' is not a valid version of Chef.
|
59
|
+
'#{ chef_version }' is not a valid version of Chef.
|
50
60
|
|
51
61
|
A list of valid versions can be found at: http://www.opscode.com/chef/install/
|
52
62
|
EOH
|
53
63
|
errors << msg
|
54
64
|
end
|
55
65
|
|
56
|
-
|
66
|
+
if errors.any?
|
67
|
+
rendered_errors = Vagrant::Util::TemplateRenderer.render(
|
68
|
+
'config/validation_failed',
|
69
|
+
errors: { 'vagrant-omnibus' => errors }
|
70
|
+
)
|
71
|
+
fail Vagrant::Errors::ConfigInvalid, errors: rendered_errors
|
72
|
+
end
|
57
73
|
end
|
58
74
|
|
59
75
|
private
|
@@ -5,24 +5,25 @@
|
|
5
5
|
require 'vagrant-omnibus'
|
6
6
|
require 'vagrant-aws'
|
7
7
|
|
8
|
-
Vagrant.configure(
|
9
|
-
config.omnibus.chef_version =
|
8
|
+
Vagrant.configure('2') do |config|
|
9
|
+
config.omnibus.chef_version = '11.4.0'
|
10
10
|
|
11
|
-
config.vm.box =
|
11
|
+
config.vm.box = 'dummy'
|
12
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
16
|
|
17
|
-
aws.instance_type =
|
18
|
-
aws.ami =
|
17
|
+
aws.instance_type = 'm1.large'
|
18
|
+
aws.ami = 'ami-2efa9d47' # Ubuntu 12.04 LTS 64-bit instance root store
|
19
19
|
|
20
|
-
override.ssh.username =
|
21
|
-
override.ssh.private_key_path =
|
20
|
+
override.ssh.username = 'ubuntu'
|
21
|
+
override.ssh.private_key_path = '~/.ssh/id_rsa'
|
22
22
|
end
|
23
23
|
|
24
24
|
config.vm.provision :chef_solo do |chef|
|
25
|
-
chef.cookbooks_path =
|
26
|
-
|
25
|
+
chef.cookbooks_path =
|
26
|
+
File.expand_path('../../../support/cookbooks', __FILE__)
|
27
|
+
chef.add_recipe 'chef-inator'
|
27
28
|
end
|
28
29
|
end
|
@@ -5,7 +5,7 @@ Vagrant.configure('2') do |config|
|
|
5
5
|
config.omnibus.chef_version = :latest
|
6
6
|
|
7
7
|
config.vm.box = 'digital_ocean'
|
8
|
-
config.vm.synced_folder '.', '/vagrant', :
|
8
|
+
config.vm.synced_folder '.', '/vagrant', disabled: true
|
9
9
|
|
10
10
|
config.vm.provider :digital_ocean do |provider, override|
|
11
11
|
provider.client_id = ENV['DO_CLIENT_ID']
|
@@ -17,7 +17,8 @@ Vagrant.configure('2') do |config|
|
|
17
17
|
end
|
18
18
|
|
19
19
|
config.vm.provision :chef_solo do |chef|
|
20
|
-
chef.cookbooks_path =
|
21
|
-
|
20
|
+
chef.cookbooks_path =
|
21
|
+
File.expand_path('../../../support/cookbooks', __FILE__)
|
22
|
+
chef.add_recipe 'chef-inator'
|
22
23
|
end
|
23
24
|
end
|
@@ -5,23 +5,24 @@
|
|
5
5
|
require 'vagrant-omnibus'
|
6
6
|
require 'vagrant-rackspace'
|
7
7
|
|
8
|
-
Vagrant.configure(
|
8
|
+
Vagrant.configure('2') do |config|
|
9
9
|
config.omnibus.chef_version = '11.4.0'
|
10
10
|
|
11
|
-
config.vm.box =
|
11
|
+
config.vm.box = 'dummy'
|
12
12
|
config.vm.provider :rackspace do |rackspace|
|
13
13
|
rackspace.username = ENV['DEV_RACKSPACE_USERNAME']
|
14
14
|
rackspace.api_key = ENV['DEV_RACKSPACE_API_KEY']
|
15
15
|
rackspace.flavor = /512MB/
|
16
16
|
rackspace.image = /Ubuntu 12.04/
|
17
|
-
rackspace.public_key_path =
|
18
|
-
# TODO
|
17
|
+
rackspace.public_key_path = '~/.ssh/id_rsa.pub'
|
18
|
+
# TODO: switch this to the `override.ssh.private_key_path` syntax once
|
19
19
|
# `vagrant-rackspace` is updated.
|
20
|
-
config.ssh.private_key_path =
|
20
|
+
config.ssh.private_key_path = '~/.ssh/id_rsa'
|
21
21
|
end
|
22
22
|
|
23
23
|
config.vm.provision :chef_solo do |chef|
|
24
|
-
chef.cookbooks_path =
|
25
|
-
|
24
|
+
chef.cookbooks_path =
|
25
|
+
File.expand_path('../../../support/cookbooks', __FILE__)
|
26
|
+
chef.add_recipe 'chef-inator'
|
26
27
|
end
|
27
28
|
end
|
@@ -1,32 +1,35 @@
|
|
1
1
|
# -*- mode: ruby -*-
|
2
2
|
# vi: set ft=ruby :
|
3
3
|
|
4
|
+
# rubocop:disable LineLength
|
5
|
+
|
4
6
|
# plugins don't seem to be auto-loaded from the bundle
|
5
7
|
require 'vagrant-omnibus'
|
8
|
+
require 'vagrant-windows'
|
6
9
|
|
7
|
-
Vagrant.configure(
|
10
|
+
Vagrant.configure('2') do |config|
|
8
11
|
|
9
12
|
config.vm.define :new_chef do |new_chef_config|
|
10
|
-
new_chef_config.vm.box =
|
11
|
-
new_chef_config.vm.box_url =
|
13
|
+
new_chef_config.vm.box = 'opscode-ubuntu-12.04'
|
14
|
+
new_chef_config.vm.box_url = 'http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box'
|
12
15
|
|
13
16
|
new_chef_config.omnibus.chef_version = :latest
|
14
17
|
|
15
18
|
new_chef_config.vm.provision :chef_solo do |chef|
|
16
|
-
chef.cookbooks_path = File.expand_path(
|
17
|
-
chef.add_recipe
|
19
|
+
chef.cookbooks_path = File.expand_path('../../../support/cookbooks', __FILE__)
|
20
|
+
chef.add_recipe 'chef-inator'
|
18
21
|
end
|
19
22
|
end
|
20
23
|
|
21
24
|
config.vm.define :old_chef do |old_chef_config|
|
22
|
-
old_chef_config.vm.box =
|
23
|
-
old_chef_config.vm.box_url =
|
25
|
+
old_chef_config.vm.box = 'opscode-centos-6.5'
|
26
|
+
old_chef_config.vm.box_url = 'http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box'
|
24
27
|
|
25
28
|
old_chef_config.omnibus.chef_version = '10.24.0'
|
26
29
|
|
27
30
|
old_chef_config.vm.provision :chef_solo do |chef|
|
28
|
-
chef.cookbooks_path = File.expand_path(
|
29
|
-
chef.add_recipe
|
31
|
+
chef.cookbooks_path = File.expand_path('../../../support/cookbooks', __FILE__)
|
32
|
+
chef.add_recipe 'chef-inator'
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
@@ -37,8 +40,27 @@ Vagrant.configure("2") do |config|
|
|
37
40
|
installed_config.omnibus.chef_version = '11.4.4'
|
38
41
|
|
39
42
|
installed_config.vm.provision :chef_solo do |chef|
|
40
|
-
chef.cookbooks_path = File.expand_path(
|
41
|
-
chef.add_recipe
|
43
|
+
chef.cookbooks_path = File.expand_path('../../../support/cookbooks', __FILE__)
|
44
|
+
chef.add_recipe 'chef-inator'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
config.vm.define :chef_on_windows do |win_config|
|
49
|
+
win_config.vm.box = 'opscode-windows-6.1'
|
50
|
+
win_config.vm.box_url = 'http://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-windows-6.1.box'
|
51
|
+
win_config.vm.boot_timeout = 500
|
52
|
+
|
53
|
+
win_config.omnibus.chef_version = :latest
|
54
|
+
|
55
|
+
win_config.vm.network :forwarded_port, guest: 3389, host: 3389
|
56
|
+
win_config.vm.network :forwarded_port, guest: 5985, host: 5985
|
57
|
+
|
58
|
+
win_config.vm.guest = :windows
|
59
|
+
win_config.winrm.timeout = 500
|
60
|
+
|
61
|
+
win_config.vm.provision :chef_solo do |chef|
|
62
|
+
chef.cookbooks_path = File.expand_path('../../../support/cookbooks', __FILE__)
|
63
|
+
chef.add_recipe 'chef-inator'
|
42
64
|
end
|
43
65
|
end
|
44
66
|
end
|
@@ -6,7 +6,10 @@
|
|
6
6
|
#
|
7
7
|
require_relative '../spec_helper'
|
8
8
|
|
9
|
+
# rubocop:disable LineLength
|
10
|
+
|
9
11
|
describe VagrantPlugins::Omnibus::Config do
|
12
|
+
let(:machine) { double('machine') }
|
10
13
|
let(:instance) { described_class.new }
|
11
14
|
|
12
15
|
subject(:config) do
|
@@ -26,17 +29,13 @@ describe VagrantPlugins::Omnibus::Config do
|
|
26
29
|
its(:chef_version) { should match(/\d*\.\d*\.\d*/) }
|
27
30
|
end
|
28
31
|
|
29
|
-
describe '
|
30
|
-
|
31
|
-
|
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)
|
32
|
+
describe 'validate' do
|
33
|
+
it 'should be no-op' do
|
34
|
+
expect(subject.validate(machine)).to eq('VagrantPlugins::Omnibus::Config' => [])
|
38
35
|
end
|
36
|
+
end
|
39
37
|
|
38
|
+
describe '#validate!' do
|
40
39
|
describe 'chef_version validation' do
|
41
40
|
{
|
42
41
|
'11.4.0' => {
|
@@ -56,11 +55,11 @@ describe VagrantPlugins::Omnibus::Config do
|
|
56
55
|
let(:chef_version) { version_string }
|
57
56
|
if opts[:valid]
|
58
57
|
it 'passes' do
|
59
|
-
|
58
|
+
expect { subject.validate!(machine) }.to_not raise_error
|
60
59
|
end
|
61
60
|
else
|
62
61
|
it 'fails' do
|
63
|
-
|
62
|
+
expect { subject.validate!(machine) }.to raise_error(Vagrant::Errors::ConfigInvalid)
|
64
63
|
end
|
65
64
|
end
|
66
65
|
end
|
data/vagrant-omnibus.gemspec
CHANGED
@@ -4,22 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'vagrant-omnibus/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'vagrant-omnibus'
|
8
8
|
spec.version = VagrantPlugins::Omnibus::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.description =
|
9
|
+
spec.authors = ['Seth Chisamore']
|
10
|
+
spec.email = ['schisamo@opscode.com']
|
11
|
+
spec.description = 'A Vagrant plugin that ensures the desired version of' \
|
12
|
+
' Chef is installed via the platform-specific Omnibus' \
|
13
|
+
' packages.'
|
12
14
|
spec.summary = spec.description
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
15
|
+
spec.homepage = 'https://github.com/schisamo/vagrant-omnibus'
|
16
|
+
spec.license = 'Apache 2.0'
|
15
17
|
|
16
|
-
spec.files = `git ls-files`.split(
|
17
|
-
spec.executables = spec.files.grep(
|
18
|
-
spec.test_files = spec.files.grep(
|
19
|
-
spec.require_paths = [
|
18
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
19
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
21
|
+
spec.require_paths = ['lib']
|
20
22
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency 'rubocop'
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'rubocop'
|
25
27
|
end
|
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.
|
4
|
+
version: 1.3.0
|
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:
|
12
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -64,17 +64,17 @@ dependencies:
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0
|
69
|
+
version: '0'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0
|
77
|
+
version: '0'
|
78
78
|
description: A Vagrant plugin that ensures the desired version of Chef is installed
|
79
79
|
via the platform-specific Omnibus packages.
|
80
80
|
email:
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 128509343253395990
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
segments:
|
136
136
|
- 0
|
137
|
-
hash:
|
137
|
+
hash: 128509343253395990
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
140
|
rubygems_version: 1.8.23
|