vagrant 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +17 -0
- data/Gemfile +1 -1
- data/bin/vagrant +3 -1
- data/lib/vagrant/plugin.rb +10 -1
- data/lib/vagrant/provisioners/chef_server.rb +19 -5
- data/lib/vagrant/provisioners/chef_solo.rb +8 -6
- data/lib/vagrant/ssh/session.rb +1 -1
- data/lib/vagrant/systems/redhat.rb +1 -0
- data/lib/vagrant/version.rb +1 -1
- data/templates/chef_server_client.erb +2 -0
- data/templates/locales/en.yml +6 -0
- data/templates/network_entry_redhat.erb +1 -0
- data/test/vagrant/provisioners/chef_server_test.rb +4 -3
- data/test/vagrant/provisioners/chef_solo_test.rb +7 -7
- data/vagrant.gemspec +2 -2
- metadata +6 -6
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## 0.7.6 (July 2, 2011)
|
2
|
+
|
3
|
+
- Run Chef commands in a single command. [GH-390]
|
4
|
+
- Add `nfs` option for Chef to mount Chef folders via NFS. [GH-378]
|
5
|
+
- Add translation for `aborted` state in VM. [GH-371]
|
6
|
+
- Use full paths with the Chef provisioner so that restart cookbook will
|
7
|
+
work. [GH-374]
|
8
|
+
- Add "--no-color" as an argument and no colorized output will be used. [GH-379]
|
9
|
+
- Added DEVICE option to the RedHat host only networking entry, which allows
|
10
|
+
host only networking to work even if the VM has multiple NICs. [GH-382]
|
11
|
+
- Touch the network configuration file for RedHat so that the `sed` works
|
12
|
+
with host only networking. [GH-381]
|
13
|
+
- Load prerelease versions of plugins if available.
|
14
|
+
- Do not load a plugin if it depends on an invalid version of Vagrant.
|
15
|
+
- Encrypted data bag support in Chef server provisioner. [GH-398]
|
16
|
+
- Use the `-H` flag to set the proper home directory for `sudo`. [GH-370]
|
17
|
+
|
1
18
|
## 0.7.5 (May 16, 2011)
|
2
19
|
|
3
20
|
- `config.ssh.port` can be specified and takes highest precedence if specified.
|
data/Gemfile
CHANGED
@@ -4,7 +4,7 @@ gem "vagrant", :path => '.'
|
|
4
4
|
|
5
5
|
# Use the following gems straight from git, since Vagrant dev
|
6
6
|
# typically coincides with it
|
7
|
-
gem "virtualbox", :git => "git://github.com/mitchellh/virtualbox.git"
|
7
|
+
gem "virtualbox", :git => "git://github.com/mitchellh/virtualbox.git", :ref => "038729cd89a15111106404726b75a1d463edc892"
|
8
8
|
|
9
9
|
# Gems required for testing only. To install run
|
10
10
|
# gem bundle test
|
data/bin/vagrant
CHANGED
@@ -5,10 +5,12 @@ require 'vagrant/cli'
|
|
5
5
|
env = Vagrant::Environment.new
|
6
6
|
|
7
7
|
begin
|
8
|
+
shell = ARGV.include?("--no-color") ? Thor::Shell::Basic.new : Thor::Base.shell.new
|
9
|
+
|
8
10
|
# Set the UI early in case any errors are raised, and load
|
9
11
|
# the config immediately, so we gather any new commands from
|
10
12
|
# plugins
|
11
|
-
env.ui = Vagrant::UI::Shell.new(env,
|
13
|
+
env.ui = Vagrant::UI::Shell.new(env, shell)
|
12
14
|
env.load!
|
13
15
|
|
14
16
|
# Kick start the CLI
|
data/lib/vagrant/plugin.rb
CHANGED
@@ -21,6 +21,9 @@ module Vagrant
|
|
21
21
|
# load path. This file is loaded to kick off the load sequence
|
22
22
|
# for that plugin.
|
23
23
|
def self.load!
|
24
|
+
# Our version is used for checking dependencies
|
25
|
+
our_version = Gem::Version.create(Vagrant::VERSION)
|
26
|
+
|
24
27
|
# RubyGems 1.8.0 deprecated `source_index`. Gem::Specification is the
|
25
28
|
# new replacement. For now, we support both, but special-case 1.8.x
|
26
29
|
# so that we avoid deprecation messages.
|
@@ -37,7 +40,13 @@ module Vagrant
|
|
37
40
|
# useful for developers.
|
38
41
|
specs = Gem::VERSION >= "1.6.0" ? source.latest_specs(true) : source.latest_specs
|
39
42
|
|
40
|
-
|
43
|
+
specs.each do |spec|
|
44
|
+
# If this gem depends on Vagrant, verify this is a valid release of
|
45
|
+
# Vagrant for this gem to load into.
|
46
|
+
vagrant_dep = spec.dependencies.find { |d| d.name == "vagrant" }
|
47
|
+
next if vagrant_dep && !vagrant_dep.requirement.satisfied_by?(our_version)
|
48
|
+
|
49
|
+
# Find a vagrant_init.rb to verify if this is a plugin
|
41
50
|
file = nil
|
42
51
|
if Gem::VERSION >= "1.8.0"
|
43
52
|
file = spec.matches_for_glob("**/vagrant_init.rb").first
|
@@ -15,6 +15,8 @@ module Vagrant
|
|
15
15
|
attr_accessor :file_cache_path
|
16
16
|
attr_accessor :file_backup_path
|
17
17
|
attr_accessor :environment
|
18
|
+
attr_accessor :encrypted_data_bag_secret_key_path
|
19
|
+
attr_accessor :encrypted_data_bag_secret
|
18
20
|
|
19
21
|
def initialize
|
20
22
|
super
|
@@ -23,6 +25,8 @@ module Vagrant
|
|
23
25
|
@client_key_path = "/etc/chef/client.pem"
|
24
26
|
@file_cache_path = "/srv/chef/file_store"
|
25
27
|
@file_backup_path = "/srv/chef/cache"
|
28
|
+
@encrypted_data_bag_secret_key_path = nil
|
29
|
+
@encrypted_data_bag_secret = "/etc/chef/encrypted_data_bag_secret"
|
26
30
|
end
|
27
31
|
|
28
32
|
def validate(errors)
|
@@ -45,6 +49,7 @@ module Vagrant
|
|
45
49
|
chown_provisioning_folder
|
46
50
|
create_client_key_folder
|
47
51
|
upload_validation_key
|
52
|
+
upload_encrypted_data_bag_secret if config.encrypted_data_bag_secret_key_path
|
48
53
|
setup_json
|
49
54
|
setup_server_config
|
50
55
|
run_chef_client
|
@@ -63,6 +68,11 @@ module Vagrant
|
|
63
68
|
env.ui.info I18n.t("vagrant.provisioners.chef.upload_validation_key")
|
64
69
|
vm.ssh.upload!(validation_key_path, guest_validation_key_path)
|
65
70
|
end
|
71
|
+
|
72
|
+
def upload_encrypted_data_bag_secret
|
73
|
+
env.ui.info I18n.t("vagrant.provisioners.chef.upload_encrypted_data_bag_secret_key")
|
74
|
+
vm.ssh.upload!(encrypted_data_bag_secret_key_path, config.encrypted_data_bag_secret)
|
75
|
+
end
|
66
76
|
|
67
77
|
def setup_server_config
|
68
78
|
setup_config("chef_server_client", "client.rb", {
|
@@ -73,20 +83,20 @@ module Vagrant
|
|
73
83
|
:client_key => config.client_key_path,
|
74
84
|
:file_cache_path => config.file_cache_path,
|
75
85
|
:file_backup_path => config.file_backup_path,
|
76
|
-
:environment => config.environment
|
86
|
+
:environment => config.environment,
|
87
|
+
:encrypted_data_bag_secret => config.encrypted_data_bag_secret
|
77
88
|
})
|
78
89
|
end
|
79
90
|
|
80
91
|
def run_chef_client
|
81
92
|
command_env = config.binary_env ? "#{config.binary_env} " : ""
|
82
|
-
|
83
|
-
"#{command_env}#{chef_binary_path("chef-client")} -c client.rb -j dna.json"]
|
93
|
+
command = "#{command_env}#{chef_binary_path("chef-client")} -c #{config.provisioning_path}/client.rb -j #{config.provisioning_path}/dna.json"
|
84
94
|
|
85
95
|
env.ui.info I18n.t("vagrant.provisioners.chef.running_client")
|
86
96
|
vm.ssh.execute do |ssh|
|
87
|
-
ssh.sudo!(
|
97
|
+
ssh.sudo!(command) do |channel, type, data|
|
88
98
|
if type == :exit_status
|
89
|
-
ssh.check_exit_status(data,
|
99
|
+
ssh.check_exit_status(data, command)
|
90
100
|
else
|
91
101
|
env.ui.info("#{data}: #{type}")
|
92
102
|
end
|
@@ -97,6 +107,10 @@ module Vagrant
|
|
97
107
|
def validation_key_path
|
98
108
|
File.expand_path(config.validation_key_path, env.root_path)
|
99
109
|
end
|
110
|
+
|
111
|
+
def encrypted_data_bag_secret_key_path
|
112
|
+
File.expand_path(config.encrypted_data_bag_secret_key_path, env.root_path)
|
113
|
+
end
|
100
114
|
|
101
115
|
def guest_validation_key_path
|
102
116
|
File.join(config.provisioning_path, "validation.pem")
|
@@ -9,6 +9,7 @@ module Vagrant
|
|
9
9
|
attr_accessor :roles_path
|
10
10
|
attr_accessor :data_bags_path
|
11
11
|
attr_accessor :recipe_url
|
12
|
+
attr_accessor :nfs
|
12
13
|
|
13
14
|
def initialize
|
14
15
|
super
|
@@ -16,6 +17,7 @@ module Vagrant
|
|
16
17
|
@cookbooks_path = ["cookbooks", [:vm, "cookbooks"]]
|
17
18
|
@roles_path = []
|
18
19
|
@data_bags_path = []
|
20
|
+
@nfs = false
|
19
21
|
end
|
20
22
|
|
21
23
|
def validate(errors)
|
@@ -42,19 +44,19 @@ module Vagrant
|
|
42
44
|
|
43
45
|
def share_cookbook_folders
|
44
46
|
host_cookbook_paths.each_with_index do |cookbook, i|
|
45
|
-
env.config.vm.share_folder("v-csc-#{i}", cookbook_path(i), cookbook)
|
47
|
+
env.config.vm.share_folder("v-csc-#{i}", cookbook_path(i), cookbook, :nfs => config.nfs)
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
49
51
|
def share_role_folders
|
50
52
|
host_role_paths.each_with_index do |role, i|
|
51
|
-
env.config.vm.share_folder("v-csr-#{i}", role_path(i), role)
|
53
|
+
env.config.vm.share_folder("v-csr-#{i}", role_path(i), role, :nfs => config.nfs)
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
55
57
|
def share_data_bags_folders
|
56
58
|
host_data_bag_paths.each_with_index do |data_bag, i|
|
57
|
-
env.config.vm.share_folder("v-csdb-#{i}", data_bag_path(i), data_bag)
|
59
|
+
env.config.vm.share_folder("v-csdb-#{i}", data_bag_path(i), data_bag, :nfs => config.nfs)
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
@@ -71,13 +73,13 @@ module Vagrant
|
|
71
73
|
|
72
74
|
def run_chef_solo
|
73
75
|
command_env = config.binary_env ? "#{config.binary_env} " : ""
|
74
|
-
|
76
|
+
command = "#{command_env}#{chef_binary_path("chef-solo")} -c #{config.provisioning_path}/solo.rb -j #{config.provisioning_path}/dna.json"
|
75
77
|
|
76
78
|
env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
|
77
79
|
vm.ssh.execute do |ssh|
|
78
|
-
ssh.sudo!(
|
80
|
+
ssh.sudo!(command) do |channel, type, data|
|
79
81
|
if type == :exit_status
|
80
|
-
ssh.check_exit_status(data,
|
82
|
+
ssh.check_exit_status(data, command)
|
81
83
|
else
|
82
84
|
env.ui.info("#{data}: #{type}")
|
83
85
|
end
|
data/lib/vagrant/ssh/session.rb
CHANGED
@@ -34,7 +34,7 @@ module Vagrant
|
|
34
34
|
# of `sudo`.
|
35
35
|
def sudo!(commands, options=nil, &block)
|
36
36
|
channel = session.open_channel do |ch|
|
37
|
-
ch.exec("sudo #{env.config.ssh.sudo_shell} -l") do |ch2, success|
|
37
|
+
ch.exec("sudo -H #{env.config.ssh.sudo_shell} -l") do |ch2, success|
|
38
38
|
# Set the terminal
|
39
39
|
ch2.send_data "export TERM=vt100\n"
|
40
40
|
|
@@ -6,6 +6,7 @@ module Vagrant
|
|
6
6
|
# interface file.
|
7
7
|
vm.ssh.execute do |ssh|
|
8
8
|
# Clear out any previous entries
|
9
|
+
ssh.exec!("sudo touch /etc/sysconfig/network-scripts/ifcfg-eth#{net_options[:adapter]}")
|
9
10
|
ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/sysconfig/network-scripts/ifcfg-eth#{net_options[:adapter]} > /tmp/vagrant-ifcfg-eth#{net_options[:adapter]}")
|
10
11
|
ssh.exec!("sudo su -c 'cat /tmp/vagrant-ifcfg-eth#{net_options[:adapter]} > /etc/sysconfig/network-scripts/ifcfg-eth#{net_options[:adapter]}'")
|
11
12
|
end
|
data/lib/vagrant/version.rb
CHANGED
@@ -10,6 +10,8 @@ validation_client_name "<%= validation_client_name %>"
|
|
10
10
|
validation_key "<%= validation_key %>"
|
11
11
|
client_key "<%= client_key %>"
|
12
12
|
|
13
|
+
encrypted_data_bag_secret "<%= encrypted_data_bag_secret %>"
|
14
|
+
|
13
15
|
<% unless environment.nil? %>
|
14
16
|
environment "<%= environment %>"
|
15
17
|
<% end %>
|
data/templates/locales/en.yml
CHANGED
@@ -187,6 +187,11 @@ en:
|
|
187
187
|
ssh:
|
188
188
|
execute: "Execute: %{command}"
|
189
189
|
status:
|
190
|
+
aborted: |-
|
191
|
+
The VM is in an aborted state. This means that it was abruptly
|
192
|
+
stopped without properly closing the session. Run `vagrant up`
|
193
|
+
to resume this virtual machine. If any problems persist, you may
|
194
|
+
have to destroy and restart the virtual machine.
|
190
195
|
output: |-
|
191
196
|
Current VM states:
|
192
197
|
|
@@ -460,6 +465,7 @@ en:
|
|
460
465
|
json: "Generating chef JSON and uploading..."
|
461
466
|
client_key_folder: "Creating folder to hold client key..."
|
462
467
|
upload_validation_key: "Uploading chef client validation key..."
|
468
|
+
upload_encrypted_data_bag_secret_key: "Uploading chef encrypted data bag secret key..."
|
463
469
|
running_client: "Running chef-client..."
|
464
470
|
running_solo: "Running chef-solo..."
|
465
471
|
invalid_provisioner: "Vagrant::Provisioners::Chef is not a valid provisioner! Use ChefSolo or ChefServer instead."
|
@@ -162,7 +162,8 @@ class ChefServerProvisionerTest < Test::Unit::TestCase
|
|
162
162
|
:client_key => @config.client_key_path,
|
163
163
|
:file_cache_path => @config.file_cache_path,
|
164
164
|
:file_backup_path => @config.file_backup_path,
|
165
|
-
:environment => @config.environment
|
165
|
+
:environment => @config.environment,
|
166
|
+
:encrypted_data_bag_secret => @config.encrypted_data_bag_secret
|
166
167
|
})
|
167
168
|
|
168
169
|
@action.setup_server_config
|
@@ -175,8 +176,8 @@ class ChefServerProvisionerTest < Test::Unit::TestCase
|
|
175
176
|
@vm.ssh.stubs(:execute).yields(@ssh)
|
176
177
|
end
|
177
178
|
|
178
|
-
should "
|
179
|
-
@ssh.expects(:sudo!).with(
|
179
|
+
should "run chef client" do
|
180
|
+
@ssh.expects(:sudo!).with("chef-client -c #{@config.provisioning_path}/client.rb -j #{@config.provisioning_path}/dna.json").once
|
180
181
|
@action.run_chef_client
|
181
182
|
end
|
182
183
|
|
@@ -69,7 +69,7 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
|
|
69
69
|
should "share each cookbook folder" do
|
70
70
|
share_seq = sequence("share_seq")
|
71
71
|
@host_cookbook_paths.each_with_index do |cookbook, i|
|
72
|
-
@env.config.vm.expects(:share_folder).with("v-csc-#{i}", @action.cookbook_path(i), cookbook).in_sequence(share_seq)
|
72
|
+
@env.config.vm.expects(:share_folder).with("v-csc-#{i}", @action.cookbook_path(i), cookbook, :nfs => false).in_sequence(share_seq)
|
73
73
|
end
|
74
74
|
|
75
75
|
@action.share_cookbook_folders
|
@@ -85,13 +85,13 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
|
|
85
85
|
should "share each role folder" do
|
86
86
|
share_seq = sequence("share_seq")
|
87
87
|
@host_role_paths.each_with_index do |role, i|
|
88
|
-
@env.config.vm.expects(:share_folder).with("v-csr-#{i}", @action.role_path(i), role).in_sequence(share_seq)
|
88
|
+
@env.config.vm.expects(:share_folder).with("v-csr-#{i}", @action.role_path(i), role, :nfs => false).in_sequence(share_seq)
|
89
89
|
end
|
90
90
|
|
91
91
|
@action.share_role_folders
|
92
92
|
end
|
93
93
|
end
|
94
|
-
|
94
|
+
|
95
95
|
context "sharing data bag folders" do
|
96
96
|
setup do
|
97
97
|
@host_data_bag_paths = ["foo", "bar"]
|
@@ -101,7 +101,7 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
|
|
101
101
|
should "share each data bag folder" do
|
102
102
|
share_seq = sequence("share_seq")
|
103
103
|
@host_data_bag_paths.each_with_index do |data_bag, i|
|
104
|
-
@env.config.vm.expects(:share_folder).with("v-csdb-#{i}", @action.data_bag_path(i), data_bag).in_sequence(share_seq)
|
104
|
+
@env.config.vm.expects(:share_folder).with("v-csdb-#{i}", @action.data_bag_path(i), data_bag, :nfs => false).in_sequence(share_seq)
|
105
105
|
end
|
106
106
|
|
107
107
|
@action.share_data_bags_folders
|
@@ -145,7 +145,7 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
|
|
145
145
|
assert_equal result, @action.host_role_paths
|
146
146
|
end
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
context "host data bags paths" do
|
150
150
|
should "get folders path for configured data bag path" do
|
151
151
|
result = mock("result")
|
@@ -249,8 +249,8 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
|
|
249
249
|
@vm.ssh.stubs(:execute).yields(@ssh)
|
250
250
|
end
|
251
251
|
|
252
|
-
should "
|
253
|
-
@ssh.expects(:sudo!).with(
|
252
|
+
should "run chef solo" do
|
253
|
+
@ssh.expects(:sudo!).with("chef-solo -c #{@config.provisioning_path}/solo.rb -j #{@config.provisioning_path}/dna.json").once
|
254
254
|
@action.run_chef_solo
|
255
255
|
end
|
256
256
|
|
data/vagrant.gemspec
CHANGED
@@ -15,10 +15,10 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rubyforge_project = "vagrant"
|
16
16
|
|
17
17
|
s.add_dependency "archive-tar-minitar", "= 0.5.2"
|
18
|
-
s.add_dependency "erubis", "~> 2.
|
18
|
+
s.add_dependency "erubis", "~> 2.7.0"
|
19
19
|
s.add_dependency "json", "~> 1.5.1"
|
20
20
|
s.add_dependency "mario", "~> 0.0.6"
|
21
|
-
s.add_dependency "net-ssh", "~> 2.1.
|
21
|
+
s.add_dependency "net-ssh", "~> 2.1.4"
|
22
22
|
s.add_dependency "net-scp", "~> 1.0.4"
|
23
23
|
s.add_dependency "i18n", "~> 0.5.0"
|
24
24
|
s.add_dependency "thor", "~> 0.14.6"
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: vagrant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mitchell Hashimoto
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-07-03 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: archive-tar-minitar
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 2.
|
34
|
+
version: 2.7.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: *id002
|
@@ -64,7 +64,7 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - ~>
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 2.1.
|
67
|
+
version: 2.1.4
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: *id005
|
@@ -421,7 +421,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
421
421
|
requirements:
|
422
422
|
- - ">="
|
423
423
|
- !ruby/object:Gem::Version
|
424
|
-
hash:
|
424
|
+
hash: -133062890691025626
|
425
425
|
segments:
|
426
426
|
- 0
|
427
427
|
version: "0"
|
@@ -434,7 +434,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
434
434
|
requirements: []
|
435
435
|
|
436
436
|
rubyforge_project: vagrant
|
437
|
-
rubygems_version: 1.8.
|
437
|
+
rubygems_version: 1.8.5
|
438
438
|
signing_key:
|
439
439
|
specification_version: 3
|
440
440
|
summary: Build and distribute virtualized development environments.
|