vagrant 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 0.9.5 (February 5, 2012)
2
+
3
+ - Fix crashing case when all network options are `:auto_config false`.
4
+ [GH-689]
5
+ - Type of network adapter can be specified with `:nic_type`. [GH-690]
6
+ - The NFS version can be specified with the `:nfs_version` option
7
+ on shared folders. [GH-557]
8
+ - Greatly improved FreeBSD guest and host support. [GH-695]
9
+ - Fix instability with RedHat guests and host only and bridged networks.
10
+ [GH-698]
11
+ - When using bridged networking, only list the network interfaces
12
+ that are up as choices. [GH-701]
13
+ - More intelligent handling of the `certname` option for puppet
14
+ server. [GH-702]
15
+ - You may now explicitly set the network to bridge to in the Vagrantfile
16
+ using the `:bridge` parameter. [GH-655]
17
+
1
18
  ## 0.9.4 (January 28, 2012)
2
19
 
3
20
  - Important internal changes to middlewares that make plugin developer's
@@ -64,7 +64,7 @@ module Vagrant
64
64
  # setup until after it is booted.
65
65
  @app.call(env)
66
66
 
67
- if !adapters.empty?
67
+ if !adapters.empty? && !networks.empty?
68
68
  # Determine the interface numbers for the guest.
69
69
  assign_interface_numbers(networks, adapters)
70
70
 
@@ -313,38 +313,70 @@ module Vagrant
313
313
  return {
314
314
  :adapter => nil,
315
315
  :mac => nil,
316
+ :bridge => nil,
316
317
  :auto_config => true
317
318
  }.merge(options)
318
319
  end
319
320
 
320
321
  def bridged_adapter(config)
322
+ # Find the bridged interfaces that are available
321
323
  bridgedifs = @env[:vm].driver.read_bridged_interfaces
324
+ bridgedifs.delete_if { |interface| interface[:status] == "Down" }
322
325
 
326
+ # The name of the chosen bridge interface will be assigned to this
327
+ # variable.
323
328
  chosen_bridge = nil
324
- if bridgedifs.length == 1
325
- # One bridgable interface? Just use it.
326
- chosen_bridge = bridgedifs[0][:name]
327
- else
328
- # More than one bridgable interface requires a user decision, so
329
- # show options to choose from.
330
- @env[:ui].info I18n.t("vagrant.actions.vm.bridged_networking.available",
331
- :prefix => false)
332
- bridgedifs.each_index do |index|
333
- interface = bridgedifs[index]
334
- @env[:ui].info("#{index + 1}) #{interface[:name]}", :prefix => false)
335
- end
336
329
 
337
- # The range of valid choices
338
- valid = Range.new(1, bridgedifs.length)
330
+ if config[:bridge]
331
+ @logger.debug("Bridge was directly specified in config, searching for: #{config[:bridge]}")
332
+
333
+ # Search for a matching bridged interface
334
+ bridgedifs.each do |interface|
335
+ if interface[:name].downcase == config[:bridge].downcase
336
+ @logger.debug("Specific bridge found as configured in the Vagrantfile. Using it.")
337
+ chosen_bridge = interface[:name]
338
+ break
339
+ end
340
+ end
339
341
 
340
- # The choice that the user has chosen as the bridging interface
341
- choice = nil
342
- while !valid.include?(choice)
343
- choice = @env[:ui].ask("What interface should the network bridge to? ")
344
- choice = choice.to_i
342
+ # If one wasn't found, then we notify the user here.
343
+ if !chosen_bridge
344
+ @env[:ui].info I18n.t("vagrant.actions.vm.bridged_networking.specific_not_found",
345
+ :bridge => config[:bridge])
345
346
  end
347
+ end
346
348
 
347
- chosen_bridge = bridgedifs[choice - 1][:name]
349
+ # If we still don't have a bridge chosen (this means that one wasn't
350
+ # specified in the Vagrantfile, or the bridge specified in the Vagrantfile
351
+ # wasn't found), then we fall back to the normal means of searchign for a
352
+ # bridged network.
353
+ if !chosen_bridge
354
+ if bridgedifs.length == 1
355
+ # One bridgable interface? Just use it.
356
+ chosen_bridge = bridgedifs[0][:name]
357
+ @logger.debug("Only one bridged interface available. Using it by default.")
358
+ else
359
+ # More than one bridgable interface requires a user decision, so
360
+ # show options to choose from.
361
+ @env[:ui].info I18n.t("vagrant.actions.vm.bridged_networking.available",
362
+ :prefix => false)
363
+ bridgedifs.each_index do |index|
364
+ interface = bridgedifs[index]
365
+ @env[:ui].info("#{index + 1}) #{interface[:name]}", :prefix => false)
366
+ end
367
+
368
+ # The range of valid choices
369
+ valid = Range.new(1, bridgedifs.length)
370
+
371
+ # The choice that the user has chosen as the bridging interface
372
+ choice = nil
373
+ while !valid.include?(choice)
374
+ choice = @env[:ui].ask("What interface should the network bridge to? ")
375
+ choice = choice.to_i
376
+ end
377
+
378
+ chosen_bridge = bridgedifs[choice - 1][:name]
379
+ end
348
380
  end
349
381
 
350
382
  @logger.info("Bridging adapter #{config[:adapter]} to #{chosen_bridge}")
@@ -354,7 +386,8 @@ module Vagrant
354
386
  :adapter => config[:adapter],
355
387
  :type => :bridged,
356
388
  :bridge => chosen_bridge,
357
- :mac_address => config[:mac]
389
+ :mac_address => config[:mac],
390
+ :nic_type => config[:nic_type],
358
391
  }
359
392
  end
360
393
 
@@ -91,6 +91,7 @@ module Vagrant
91
91
  key, opts = data
92
92
  opts[:map_uid] = prepare_permission(:uid, opts)
93
93
  opts[:map_gid] = prepare_permission(:gid, opts)
94
+ opts[:nfs_version] ||= 3
94
95
 
95
96
  acc[key] = opts
96
97
  acc
@@ -112,6 +112,10 @@ module Vagrant
112
112
  args.concat(["--macaddress#{adapter[:adapter]}",
113
113
  adapter[:mac_address]])
114
114
  end
115
+
116
+ if adapter[:nic_type]
117
+ args.concat(["--nictype#{adapter[:adapter]}", adapter[:nic_type].to_s])
118
+ end
115
119
  end
116
120
 
117
121
  execute("modifyvm", @uuid, *args)
@@ -112,6 +112,10 @@ module Vagrant
112
112
  args.concat(["--macaddress#{adapter[:adapter]}",
113
113
  adapter[:mac_address]])
114
114
  end
115
+
116
+ if adapter[:nic_type]
117
+ args.concat(["--nictype#{adapter[:adapter]}", adapter[:nic_type].to_s])
118
+ end
115
119
  end
116
120
 
117
121
  execute("modifyvm", @uuid, *args)
@@ -38,7 +38,10 @@ module Vagrant
38
38
  end
39
39
  end
40
40
 
41
- # TODO: Error/warning about this.
41
+ # TODO: vboxsf is currently unsupported in FreeBSD, if you are able to
42
+ # help out with this project, please contact vbox@FreeBSD.org
43
+ #
44
+ # See: http://wiki.freebsd.org/VirtualBox/ToDo
42
45
  # def mount_shared_folder(ssh, name, guestpath)
43
46
  # ssh.exec!("sudo mkdir -p #{guestpath}")
44
47
  # # Using a custom mount method here; could use improvement.
@@ -53,23 +56,18 @@ module Vagrant
53
56
  end
54
57
  end
55
58
 
56
- def prepare_host_only_network(net_options=nil)
59
+ def configure_networks(networks)
57
60
  # Remove any previous host only network additions to the
58
61
  # interface file.
59
- vm.ssh.execute do |ssh|
60
- # Clear out any previous entries
61
- ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN-HOSTONLY/,/^#VAGRANT-END-HOSTONLY/ d' /etc/rc.conf > /tmp/rc.conf")
62
- ssh.exec!("sudo mv /tmp/rc.conf /etc/rc.conf")
63
- end
64
- end
62
+ vm.channel.sudo("sed -e '/^#VAGRANT-BEGIN-HOSTONLY/,/^#VAGRANT-END-HOSTONLY/ d' /etc/rc.conf > /tmp/rc.conf")
63
+ vm.channel.sudo("mv /tmp/rc.conf /etc/rc.conf")
65
64
 
66
- def enable_host_only_network(net_options)
67
- entry = "#VAGRANT-BEGIN-HOSTONLY\nifconfig_em#{net_options[:adapter]}=\"inet #{net_options[:ip]} netmask #{net_options[:netmask]}\"\n#VAGRANT-END-HOSTONLY\n"
68
- vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")
65
+ networks.each do |network|
66
+ entry = "#VAGRANT-BEGIN-HOSTONLY\nifconfig_em#{network[:interface]}=\"inet #{network[:ip]} netmask #{network[:netmask]}\"\n#VAGRANT-END-HOSTONLY\n"
67
+ vm.channel.upload(StringIO.new(entry), "/tmp/vagrant-network-entry")
69
68
 
70
- vm.ssh.execute do |ssh|
71
- ssh.exec!("sudo su -m root -c 'cat /tmp/vagrant-network-entry >> /etc/rc.conf'")
72
- ssh.exec!("sudo ifconfig em#{net_options[:adapter]} inet #{net_options[:ip]} netmask #{net_options[:netmask]}")
69
+ vm.channel.sudo("su -m root -c 'cat /tmp/vagrant-network-entry >> /etc/rc.conf'")
70
+ vm.channel.sudo("ifconfig em#{network[:interface]} inet #{network[:ip]} netmask #{network[:netmask]}")
73
71
  end
74
72
  end
75
73
  end
@@ -60,7 +60,7 @@ module Vagrant
60
60
 
61
61
  # Do the actual creating and mounting
62
62
  @vm.channel.sudo("mkdir -p #{real_guestpath}")
63
- @vm.channel.sudo("mount #{ip}:'#{opts[:hostpath]}' #{real_guestpath}",
63
+ @vm.channel.sudo("mount -o vers=#{opts[:nfs_version]} #{ip}:'#{opts[:hostpath]}' #{real_guestpath}",
64
64
  :error_class => LinuxError,
65
65
  :error_key => :mount_nfs_fail)
66
66
  end
@@ -41,7 +41,7 @@ module Vagrant
41
41
  interfaces.each do |interface|
42
42
  vm.channel.sudo("/sbin/ifconfig eth#{interface} down 2> /dev/null")
43
43
  vm.channel.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-eth#{interface}")
44
- vm.channel.sudo("/sbin/ifup eth#{interface}")
44
+ vm.channel.sudo("/sbin/ifconfig eth#{interface} up 2> /dev/null")
45
45
  end
46
46
  end
47
47
 
@@ -24,6 +24,7 @@ module Vagrant
24
24
 
25
25
  @logger = Log4r::Logger.new("vagrant::hosts::bsd")
26
26
  @nfs_restart_command = "sudo nfsd restart"
27
+ @nfs_exports_template = "nfs/exports"
27
28
  end
28
29
 
29
30
  def nfs?
@@ -33,7 +34,7 @@ module Vagrant
33
34
  end
34
35
 
35
36
  def nfs_export(id, ip, folders)
36
- output = TemplateRenderer.render('nfs/exports',
37
+ output = TemplateRenderer.render(@nfs_exports_template,
37
38
  :uuid => id,
38
39
  :ip => ip,
39
40
  :folders => folders)
@@ -4,6 +4,10 @@ module Vagrant
4
4
  module Hosts
5
5
  # Represents a FreeBSD host
6
6
  class FreeBSD < BSD
7
+ class FreeBSDHostError < Errors::VagrantError
8
+ error_namespace("vagrant.hosts.freebsd")
9
+ end
10
+
7
11
  include Util
8
12
  include Util::Retryable
9
13
 
@@ -16,10 +20,21 @@ module Vagrant
16
20
  5
17
21
  end
18
22
 
23
+ def nfs_export(id, ip, folders)
24
+ folders.each do |folder_name, folder_values|
25
+ if folder_values[:hostpath] =~ /\s+/
26
+ raise FreeBSDHostError, :_key => :nfs_whitespace
27
+ end
28
+ end
29
+
30
+ super
31
+ end
32
+
19
33
  def initialize(*args)
20
34
  super
21
35
 
22
36
  @nfs_restart_command = "sudo /etc/rc.d/mountd onereload"
37
+ @nfs_exports_template = "nfs/exports_freebsd"
23
38
  end
24
39
  end
25
40
  end
@@ -10,11 +10,8 @@ module Vagrant
10
10
  attr_accessor :puppet_node
11
11
  attr_accessor :options
12
12
 
13
- def initialize
14
- @puppet_server = "puppet"
15
- @puppet_node = "puppet_node"
16
- @options = []
17
- end
13
+ def puppet_server; @puppet_server || "puppet"; end
14
+ def options; @options ||= []; end
18
15
  end
19
16
 
20
17
  def self.config_class
@@ -35,14 +32,28 @@ module Vagrant
35
32
 
36
33
  def run_puppetd_client
37
34
  options = config.options
38
- options = options.join(" ") if options.is_a?(Array)
35
+ options = [options] if !options.is_a?(Array)
36
+
37
+ # Intelligently set the puppet node cert name based on certain
38
+ # external parameters.
39
+ cn = nil
39
40
  if config.puppet_node
41
+ # If a node name is given, we use that directly for the certname
40
42
  cn = config.puppet_node
43
+ elsif env[:vm].config.vm.host_name
44
+ # If a host name is given, we explicitly set the certname to
45
+ # nil so that the hostname becomes the cert name.
46
+ cn = nil
41
47
  else
48
+ # Otherwise, we default to the name of the box.
42
49
  cn = env[:vm].config.vm.box
43
50
  end
44
51
 
45
- command = "puppetd #{options} --server #{config.puppet_server} --certname #{cn}"
52
+ # Add the certname option if there is one
53
+ options += ["--certname", cn] if cn
54
+ options = options.join(" ")
55
+
56
+ command = "puppetd #{options} --server #{config.puppet_server}"
46
57
 
47
58
  env[:ui].info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")
48
59
  env[:vm].channel.sudo(command) do |type, data|
@@ -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.9.4"
5
+ VERSION = "0.9.5"
6
6
  end
@@ -299,6 +299,9 @@ en:
299
299
  Enabling bridged network...
300
300
  preparing: |-
301
301
  Preparing bridged networking...
302
+ specific_not_found: |-
303
+ Specific bridge '%{bridge}' not found. You may be asked to specify
304
+ which network to bridge to.
302
305
  check_box:
303
306
  not_found: Box %{name} was not found. Fetching box from specified URL...
304
307
  not_specified: |-
@@ -383,7 +386,8 @@ en:
383
386
  forwarding_entry: |-
384
387
  -- %{guest_port} => %{host_port} (adapter %{adapter})
385
388
  non_nat: |-
386
- VirtualBox adapter #%{adapter} not configured as "NAT". Skipping: '%{name}'.
389
+ VirtualBox adapter #%{adapter} not configured as "NAT". Skipping port
390
+ forwards on this adapter.
387
391
  privileged_ports: |-
388
392
  You are trying to forward to privileged ports (ports <= 1024). Most
389
393
  operating systems restrict this to only privileged process (typically
@@ -554,6 +558,10 @@ en:
554
558
  arch:
555
559
  nfs_export:
556
560
  prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."
561
+ freebsd:
562
+ nfs_whitespace: |-
563
+ FreeBSD hosts do not support sharing directories with whitespace in
564
+ their path. Please adjust your path accordingly.
557
565
 
558
566
  provisioners:
559
567
  chef:
@@ -0,0 +1,5 @@
1
+ # VAGRANT-BEGIN: <%= uuid %>
2
+ <% folders.each do |name, opts| %>
3
+ <%= opts[:hostpath] %> <%= ip %><% if opts[:map_uid] -%> -alldirs -mapall=<%= [opts[:map_uid],opts[:map_gid]].compact.join(":") %><% end -%>
4
+ <% end %>
5
+ # VAGRANT-END: <%= uuid %>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 4
10
- version: 0.9.4
9
+ - 5
10
+ version: 0.9.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mitchell Hashimoto
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-01-29 00:00:00 Z
19
+ date: 2012-02-05 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -442,6 +442,7 @@ files:
442
442
  - templates/guests/redhat/network_static.erb
443
443
  - templates/locales/en.yml
444
444
  - templates/nfs/exports.erb
445
+ - templates/nfs/exports_freebsd.erb
445
446
  - templates/nfs/exports_linux.erb
446
447
  - templates/package_Vagrantfile.erb
447
448
  - templates/provisioners/chef_client/client.erb