vagrantup 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d141d5cc631baefb68f687fa58d80ea23ce02eb8
4
- data.tar.gz: 6728e47dee0afb290b4af6454573177f5b730752
3
+ metadata.gz: d7d31b82477e92d819dfcf3cacd1c3c1937aa23c
4
+ data.tar.gz: 23468e566647b7d074767310bbe7730841dcdbdd
5
5
  SHA512:
6
- metadata.gz: 1641fb390cea4223932a2d19c1f65877b63803569cc17e9bbf904d9063d855e0907ee801ebb2b72904f433ab5331e54aa592cfec70a212f5f3cfbe3db9154c1e
7
- data.tar.gz: 407d67d12bf887a4c35fc57fda51303ab43b0459a8bb87f5068df7cbf94974b37d141da355f359659f93d71c4d66da74ac1bcc19a9aa4f78598fe8fa3a4e4f2d
6
+ metadata.gz: d8c234f9ef302f5a9825f28cefda8e06af5c17ff9b2ea957d83ef74eaf4fc4f94cea55422930aaf0a82bddd97e8c8efb609bf74cbeb653c860e98bb0d1ff79dd
7
+ data.tar.gz: bc7c91fa7f91fe028902cb8f07384ac578f2d56c2c31fc293da074db88eb0da1b8aae4ec10ff0ca58f80d1fbe45659dc70ce71e6a1817080719a778d0cc02b0f
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
@@ -35,7 +35,7 @@ module Vagrant
35
35
  options = {
36
36
  :guestport => guestport,
37
37
  :hostport => hostport,
38
- :protocol => "TCP",
38
+ :protocol => :tcp,
39
39
  :adapter => 0,
40
40
  :auto => false
41
41
  }.merge(options || {})
data/lib/vagrant/hosts.rb CHANGED
@@ -3,5 +3,6 @@ module Vagrant
3
3
  autoload :Base, 'vagrant/hosts/base'
4
4
  autoload :BSD, 'vagrant/hosts/bsd'
5
5
  autoload :Linux, 'vagrant/hosts/linux'
6
+ autoload :Arch, 'vagrant/hosts/arch'
6
7
  end
7
8
  end
@@ -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
@@ -31,6 +31,7 @@ module Vagrant
31
31
  classes = {
32
32
  :darwin => BSD,
33
33
  :bsd => BSD,
34
+ :arch => Arch,
34
35
  :linux => Linux
35
36
  }
36
37
 
@@ -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
- ssh.check_exit_status(data, commands) if type == :exit_status
69
- env.ui.info("#{data}: #{type}") if type != :exit_status
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
@@ -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.5) do
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
 
@@ -8,3 +8,4 @@ require 'vagrant/systems/solaris'
8
8
  require 'vagrant/systems/debian'
9
9
  require 'vagrant/systems/gentoo'
10
10
  require 'vagrant/systems/redhat'
11
+ require 'vagrant/systems/ubuntu'
@@ -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 service hostname start")
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
- return :debian if ssh.test?("cat /etc/debian_version")
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
  #
@@ -12,7 +12,7 @@ module Vagrant
12
12
 
13
13
  begin
14
14
  return yield
15
- rescue opts[:on]
15
+ rescue *opts[:on]
16
16
  if (opts[:tries] -= 1) > 0
17
17
  sleep opts[:sleep].to_f if opts[:sleep]
18
18
  retry
@@ -2,5 +2,5 @@ module Vagrant
2
2
  # This will always be up to date with the current version of Vagrant,
3
3
  # since it is used to generate the gemspec and is also the source of
4
4
  # the version for `vagrant -v`
5
- VERSION = "0.7.2"
5
+ VERSION = "0.7.3"
6
6
  end
data/lib/vagrant/vm.rb CHANGED
@@ -59,6 +59,7 @@ module Vagrant
59
59
  # Hard-coded internal systems
60
60
  mapping = {
61
61
  :debian => Systems::Debian,
62
+ :ubuntu => Systems::Ubuntu,
62
63
  :freebsd => Systems::FreeBSD,
63
64
  :gentoo => Systems::Gentoo,
64
65
  :redhat => Systems::Redhat,
@@ -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
- file_store_path "/srv/chef/file_store"
14
- file_cache_path "/srv/chef/cache"
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 = { :mysql_password => "foo" }
57
+ # chef.json.merge!({ :mysql_password => "foo" })
39
58
  # end
40
59
 
41
60
  # Enable provisioning with chef server, specifying the chef server URL,
@@ -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..."
@@ -3,5 +3,3 @@
3
3
  # Please do not modify any of these contents.
4
4
  config_eth<%= net_options[:adapter] %>=("<%= net_options[:ip] %> netmask <%= net_options[:netmask] %>")
5
5
  #VAGRANT-END
6
- ~
7
-
@@ -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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrantup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
@@ -306,6 +306,7 @@ files:
306
306
  - lib/vagrant/environment.rb
307
307
  - lib/vagrant/errors.rb
308
308
  - lib/vagrant/hosts.rb
309
+ - lib/vagrant/hosts/arch.rb
309
310
  - lib/vagrant/hosts/base.rb
310
311
  - lib/vagrant/hosts/bsd.rb
311
312
  - lib/vagrant/hosts/linux.rb
@@ -330,6 +331,7 @@ files:
330
331
  - lib/vagrant/systems/linux/error.rb
331
332
  - lib/vagrant/systems/redhat.rb
332
333
  - lib/vagrant/systems/solaris.rb
334
+ - lib/vagrant/systems/ubuntu.rb
333
335
  - lib/vagrant/test_helpers.rb
334
336
  - lib/vagrant/ui.rb
335
337
  - lib/vagrant/util.rb