vagrant 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -0
- data/lib/vagrant/action/vm/forward_ports.rb +1 -0
- data/lib/vagrant/config/vm.rb +1 -1
- data/lib/vagrant/hosts.rb +1 -0
- data/lib/vagrant/hosts/arch.rb +27 -0
- data/lib/vagrant/hosts/base.rb +1 -0
- data/lib/vagrant/provisioners/chef_server.rb +7 -1
- data/lib/vagrant/provisioners/chef_solo.rb +5 -2
- data/lib/vagrant/ssh/session.rb +7 -1
- data/lib/vagrant/systems.rb +1 -0
- data/lib/vagrant/systems/debian.rb +2 -2
- data/lib/vagrant/systems/linux.rb +5 -1
- data/lib/vagrant/systems/ubuntu.rb +17 -0
- data/lib/vagrant/util/platform.rb +7 -0
- data/lib/vagrant/util/retryable.rb +1 -1
- data/lib/vagrant/version.rb +1 -1
- data/lib/vagrant/vm.rb +1 -0
- data/templates/chef_server_client.erb +2 -2
- data/templates/commands/init/Vagrantfile.erb +20 -1
- data/templates/locales/en.yml +4 -0
- data/templates/network_entry_gentoo.erb +0 -2
- data/test/vagrant/provisioners/chef_server_test.rb +3 -1
- data/test/vagrant/util/retryable_test.rb +12 -0
- metadata +5 -3
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 0.7.3 (April 19, 2011)
|
2
|
+
|
3
|
+
- Retry all SSH on Net::SSH::Disconnect in case SSH is just restarting. [GH-313]
|
4
|
+
- Add NFS shared folder support for Arch linux. [GH-346]
|
5
|
+
- Fix issue with unknown terminal type output for sudo commands.
|
6
|
+
- Forwarded port protocol can now be set as UDP. [GH-311]
|
7
|
+
- Chef server file cache path and file backup path can be configured. [GH-310]
|
8
|
+
- Setting hostname should work on Debian now. [GH-307]
|
9
|
+
|
1
10
|
## 0.7.2 (February 8, 2011)
|
2
11
|
|
3
12
|
- Update JSON dependency to 1.5.1, which works with Ruby 1.9 on
|
@@ -125,6 +125,7 @@ module Vagrant
|
|
125
125
|
port.name = name
|
126
126
|
port.guestport = options[:guestport]
|
127
127
|
port.hostport = options[:hostport]
|
128
|
+
port.protocol = options[:protocol] || :tcp
|
128
129
|
@env["vm"].vm.network_adapters[options[:adapter]].nat_driver.forwarded_ports << port
|
129
130
|
end
|
130
131
|
end
|
data/lib/vagrant/config/vm.rb
CHANGED
data/lib/vagrant/hosts.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Hosts
|
3
|
+
class Arch < Linux
|
4
|
+
def nfs_export(ip, folders)
|
5
|
+
output = TemplateRenderer.render('nfs/exports_linux',
|
6
|
+
:uuid => env.vm.uuid,
|
7
|
+
:ip => ip,
|
8
|
+
:folders => folders)
|
9
|
+
|
10
|
+
env.ui.info I18n.t("vagrant.hosts.arch.nfs_export.prepare")
|
11
|
+
sleep 0.5
|
12
|
+
|
13
|
+
output.split("\n").each do |line|
|
14
|
+
# This should only ask for administrative permission once, even
|
15
|
+
# though its executed in multiple subshells.
|
16
|
+
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
|
17
|
+
end
|
18
|
+
|
19
|
+
# We run restart here instead of "update" just in case nfsd
|
20
|
+
# is not starting
|
21
|
+
system("sudo /etc/rc.d/rpcbind restart")
|
22
|
+
system("sudo /etc/rc.d/nfs-common restart")
|
23
|
+
system("sudo /etc/rc.d/nfs-server restart")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/vagrant/hosts/base.rb
CHANGED
@@ -12,12 +12,16 @@ module Vagrant
|
|
12
12
|
attr_accessor :validation_key_path
|
13
13
|
attr_accessor :validation_client_name
|
14
14
|
attr_accessor :client_key_path
|
15
|
+
attr_accessor :file_cache_path
|
16
|
+
attr_accessor :file_backup_path
|
15
17
|
|
16
18
|
def initialize
|
17
19
|
super
|
18
20
|
|
19
21
|
@validation_client_name = "chef-validator"
|
20
22
|
@client_key_path = "/etc/chef/client.pem"
|
23
|
+
@file_cache_path = "/srv/chef/file_store"
|
24
|
+
@file_backup_path = "/srv/chef/cache"
|
21
25
|
end
|
22
26
|
|
23
27
|
def validate(errors)
|
@@ -65,7 +69,9 @@ module Vagrant
|
|
65
69
|
:chef_server_url => config.chef_server_url,
|
66
70
|
:validation_client_name => config.validation_client_name,
|
67
71
|
:validation_key => guest_validation_key_path,
|
68
|
-
:client_key => config.client_key_path
|
72
|
+
:client_key => config.client_key_path,
|
73
|
+
:file_cache_path => config.file_cache_path,
|
74
|
+
:file_backup_path => config.file_backup_path
|
69
75
|
})
|
70
76
|
end
|
71
77
|
|
@@ -65,8 +65,11 @@ module Vagrant
|
|
65
65
|
env.ui.info I18n.t("vagrant.provisioners.chef.running_solo")
|
66
66
|
vm.ssh.execute do |ssh|
|
67
67
|
ssh.sudo!(commands) do |channel, type, data|
|
68
|
-
|
69
|
-
|
68
|
+
if type == :exit_status
|
69
|
+
ssh.check_exit_status(data, commands)
|
70
|
+
else
|
71
|
+
env.ui.info("#{data}: #{type}")
|
72
|
+
end
|
70
73
|
end
|
71
74
|
end
|
72
75
|
end
|
data/lib/vagrant/ssh/session.rb
CHANGED
@@ -35,6 +35,9 @@ module Vagrant
|
|
35
35
|
def sudo!(commands, options=nil, &block)
|
36
36
|
channel = session.open_channel do |ch|
|
37
37
|
ch.exec("sudo #{env.config.ssh.sudo_shell} -l") do |ch2, success|
|
38
|
+
# Set the terminal
|
39
|
+
ch2.send_data "export TERM=vt100\n"
|
40
|
+
|
38
41
|
# Output each command as if they were entered on the command line
|
39
42
|
[commands].flatten.each do |command|
|
40
43
|
ch2.send_data "#{command}\n"
|
@@ -58,7 +61,7 @@ module Vagrant
|
|
58
61
|
# the actual `exec!` implementation, except that this
|
59
62
|
# implementation also reports `:exit_status` to the block if given.
|
60
63
|
def exec!(command, options=nil, &block)
|
61
|
-
retryable(:tries => 5, :on => IOError, :sleep => 0
|
64
|
+
retryable(:tries => 5, :on => [IOError, Net::SSH::Disconnect], :sleep => 1.0) do
|
62
65
|
metach = session.open_channel do |channel|
|
63
66
|
channel.exec(command) do |ch, success|
|
64
67
|
raise "could not execute command: #{command.inspect}" unless success
|
@@ -85,6 +88,9 @@ module Vagrant
|
|
85
88
|
|
86
89
|
# Output stdout data to the block
|
87
90
|
channel.on_data do |ch2, data|
|
91
|
+
# This clears the screen, we want to filter it out.
|
92
|
+
data.gsub!("\e[H", "")
|
93
|
+
|
88
94
|
block.call(ch2, :stdout, data)
|
89
95
|
end
|
90
96
|
|
data/lib/vagrant/systems.rb
CHANGED
@@ -25,9 +25,9 @@ module Vagrant
|
|
25
25
|
def change_host_name(name)
|
26
26
|
vm.ssh.execute do |ssh|
|
27
27
|
if !ssh.test?("sudo hostname | grep '#{name}'")
|
28
|
-
ssh.exec!("sudo sed -i 's/.*$/#{name}/' /etc/hostname")
|
29
28
|
ssh.exec!("sudo sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
30
|
-
ssh.exec!("sudo
|
29
|
+
ssh.exec!("sudo sed -i 's/.*$/#{name}/' /etc/hostname")
|
30
|
+
ssh.exec!("sudo hostname -F /etc/hostname")
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -6,7 +6,11 @@ module Vagrant
|
|
6
6
|
class Linux < Base
|
7
7
|
def distro_dispatch
|
8
8
|
vm.ssh.execute do |ssh|
|
9
|
-
|
9
|
+
if ssh.test?("cat /etc/debian_version")
|
10
|
+
return :debian if ssh.test?("cat /proc/version | grep 'Debian'")
|
11
|
+
return :ubuntu if ssh.test?("cat /proc/version | grep 'Ubuntu'")
|
12
|
+
end
|
13
|
+
|
10
14
|
return :gentoo if ssh.test?("cat /etc/gentoo-release")
|
11
15
|
return :redhat if ssh.test?("cat /etc/redhat-release")
|
12
16
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'vagrant/systems/debian'
|
2
|
+
|
3
|
+
module Vagrant
|
4
|
+
module Systems
|
5
|
+
class Ubuntu < Debian
|
6
|
+
def change_host_name(name)
|
7
|
+
vm.ssh.execute do |ssh|
|
8
|
+
if !ssh.test?("sudo hostname | grep '#{name}'")
|
9
|
+
ssh.exec!("sudo sed -i 's/.*$/#{name}/' /etc/hostname")
|
10
|
+
ssh.exec!("sudo sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
11
|
+
ssh.exec!("sudo service hostname start")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -28,6 +28,13 @@ module Vagrant
|
|
28
28
|
false
|
29
29
|
end
|
30
30
|
|
31
|
+
def arch?
|
32
|
+
linux? &&
|
33
|
+
File.exist?('/etc/rc.conf') &&
|
34
|
+
File.exist?('/etc/pacman.conf') &&
|
35
|
+
File.exist?('/etc/rc.d/')
|
36
|
+
end
|
37
|
+
|
31
38
|
# Returns boolean noting whether this is a 64-bit CPU. This
|
32
39
|
# is not 100% accurate and there could easily be false negatives.
|
33
40
|
#
|
data/lib/vagrant/version.rb
CHANGED
data/lib/vagrant/vm.rb
CHANGED
@@ -10,8 +10,8 @@ validation_client_name "<%= validation_client_name %>"
|
|
10
10
|
validation_key "<%= validation_key %>"
|
11
11
|
client_key "<%= client_key %>"
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
file_cache_path "<%= file_cache_path %>"
|
14
|
+
file_backup_path "<%= file_backup_path %>"
|
15
15
|
|
16
16
|
pid_file "/var/run/chef/chef-client.pid"
|
17
17
|
|
@@ -26,6 +26,25 @@ Vagrant::Config.run do |config|
|
|
26
26
|
# folder, and the third is the path on the host to the actual folder.
|
27
27
|
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
|
28
28
|
|
29
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
30
|
+
# are contained in a directory path relative to this Vagrantfile.
|
31
|
+
# You will need to create the manifests directory and a manifest in
|
32
|
+
# the file <%= box_name %>.pp in the manifests_path directory.
|
33
|
+
#
|
34
|
+
# An example Puppet manifest to provision the message of the day:
|
35
|
+
#
|
36
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
37
|
+
# #
|
38
|
+
# # file { '/etc/motd':
|
39
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
40
|
+
# # Managed by Puppet.\n"
|
41
|
+
# # }
|
42
|
+
#
|
43
|
+
# config.vm.provision :puppet do |puppet|
|
44
|
+
# puppet.manifests_path = "manifests"
|
45
|
+
# puppet.manifest_file = "<%= box_name %>.pp"
|
46
|
+
# end
|
47
|
+
|
29
48
|
# Enable provisioning with chef solo, specifying a cookbooks path (relative
|
30
49
|
# to this Vagrantfile), and adding some recipes and/or roles.
|
31
50
|
#
|
@@ -35,7 +54,7 @@ Vagrant::Config.run do |config|
|
|
35
54
|
# chef.add_role "web"
|
36
55
|
#
|
37
56
|
# # You may also specify custom JSON attributes:
|
38
|
-
# chef.json
|
57
|
+
# chef.json.merge!({ :mysql_password => "foo" })
|
39
58
|
# end
|
40
59
|
|
41
60
|
# Enable provisioning with chef server, specifying the chef server URL,
|
data/templates/locales/en.yml
CHANGED
@@ -451,6 +451,10 @@ en:
|
|
451
451
|
nfs_export:
|
452
452
|
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."
|
453
453
|
|
454
|
+
arch:
|
455
|
+
nfs_export:
|
456
|
+
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."
|
457
|
+
|
454
458
|
provisioners:
|
455
459
|
chef:
|
456
460
|
json: "Generating chef JSON and uploading..."
|
@@ -159,7 +159,9 @@ class ChefServerProvisionerTest < Test::Unit::TestCase
|
|
159
159
|
:chef_server_url => @config.chef_server_url,
|
160
160
|
:validation_client_name => @config.validation_client_name,
|
161
161
|
:validation_key => @action.guest_validation_key_path,
|
162
|
-
:client_key => @config.client_key_path
|
162
|
+
:client_key => @config.client_key_path,
|
163
|
+
:file_cache_path => @config.file_cache_path,
|
164
|
+
:file_backup_path => @config.file_backup_path
|
163
165
|
})
|
164
166
|
|
165
167
|
@action.setup_server_config
|
@@ -31,6 +31,18 @@ class RetryableUtilTest < Test::Unit::TestCase
|
|
31
31
|
}
|
32
32
|
end
|
33
33
|
|
34
|
+
should "retry on multiple exceptions given" do
|
35
|
+
proc = mock("proc")
|
36
|
+
proc.expects(:call).twice
|
37
|
+
|
38
|
+
assert_raises(StandardError) {
|
39
|
+
@klass.retryable(:tries => 2, :on => [StandardError, RuntimeError]) do
|
40
|
+
proc.call
|
41
|
+
raise StandardError
|
42
|
+
end
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
34
46
|
should "return the value of the block" do
|
35
47
|
result = @klass.retryable { 7 }
|
36
48
|
assert_equal 7, result
|
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.3
|
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-04-19 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -271,6 +271,7 @@ files:
|
|
271
271
|
- lib/vagrant/environment.rb
|
272
272
|
- lib/vagrant/errors.rb
|
273
273
|
- lib/vagrant/hosts.rb
|
274
|
+
- lib/vagrant/hosts/arch.rb
|
274
275
|
- lib/vagrant/hosts/base.rb
|
275
276
|
- lib/vagrant/hosts/bsd.rb
|
276
277
|
- lib/vagrant/hosts/linux.rb
|
@@ -295,6 +296,7 @@ files:
|
|
295
296
|
- lib/vagrant/systems/linux/error.rb
|
296
297
|
- lib/vagrant/systems/redhat.rb
|
297
298
|
- lib/vagrant/systems/solaris.rb
|
299
|
+
- lib/vagrant/systems/ubuntu.rb
|
298
300
|
- lib/vagrant/test_helpers.rb
|
299
301
|
- lib/vagrant/ui.rb
|
300
302
|
- lib/vagrant/util.rb
|
@@ -421,7 +423,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
421
423
|
requirements:
|
422
424
|
- - ">="
|
423
425
|
- !ruby/object:Gem::Version
|
424
|
-
hash:
|
426
|
+
hash: 1249069631573573223
|
425
427
|
segments:
|
426
428
|
- 0
|
427
429
|
version: "0"
|