vagrant 0.8.7 → 0.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/.gitignore +21 -0
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +38 -8
  4. data/Rakefile +13 -6
  5. data/bin/vagrant +6 -1
  6. data/config/default.rb +2 -2
  7. data/lib/vagrant/action/box/download.rb +14 -2
  8. data/lib/vagrant/action/vm/check_box.rb +8 -1
  9. data/lib/vagrant/action/vm/check_guest_additions.rb +6 -3
  10. data/lib/vagrant/action/vm/share_folders.rb +12 -1
  11. data/lib/vagrant/command/init.rb +1 -1
  12. data/lib/vagrant/downloaders/http.rb +29 -2
  13. data/lib/vagrant/hosts.rb +1 -0
  14. data/lib/vagrant/hosts/bsd.rb +1 -0
  15. data/lib/vagrant/hosts/freebsd.rb +51 -0
  16. data/lib/vagrant/provisioners/chef.rb +6 -5
  17. data/lib/vagrant/provisioners/chef_client.rb +1 -1
  18. data/lib/vagrant/provisioners/chef_solo.rb +13 -4
  19. data/lib/vagrant/ssh.rb +24 -49
  20. data/lib/vagrant/ssh/session.rb +1 -1
  21. data/lib/vagrant/systems/solaris.rb +57 -11
  22. data/lib/vagrant/test_helpers.rb +23 -0
  23. data/lib/vagrant/ui.rb +1 -1
  24. data/lib/vagrant/util.rb +0 -1
  25. data/lib/vagrant/util/file_checksum.rb +38 -0
  26. data/lib/vagrant/util/platform.rb +1 -1
  27. data/lib/vagrant/util/safe_exec.rb +2 -1
  28. data/lib/vagrant/version.rb +1 -1
  29. data/tasks/acceptance.rake +113 -0
  30. data/tasks/bundler.rake +3 -0
  31. data/tasks/test.rake +15 -0
  32. data/templates/commands/init/Vagrantfile.erb +3 -0
  33. data/templates/locales/en.yml +1 -1
  34. data/test/acceptance/base.rb +48 -0
  35. data/test/acceptance/box_test.rb +77 -0
  36. data/test/acceptance/destroy_test.rb +37 -0
  37. data/test/acceptance/halt_test.rb +72 -0
  38. data/test/acceptance/init_test.rb +33 -0
  39. data/test/acceptance/resume_test.rb +17 -0
  40. data/test/acceptance/ssh_test.rb +41 -0
  41. data/test/acceptance/support/config.rb +42 -0
  42. data/test/acceptance/support/isolated_environment.rb +226 -0
  43. data/test/acceptance/support/matchers/have_color.rb +9 -0
  44. data/test/acceptance/support/matchers/match_output.rb +14 -0
  45. data/test/acceptance/support/output.rb +87 -0
  46. data/test/acceptance/support/shared/base_context.rb +65 -0
  47. data/test/acceptance/support/shared/command_examples.rb +33 -0
  48. data/test/acceptance/support/tempdir.rb +34 -0
  49. data/test/acceptance/support/virtualbox.rb +36 -0
  50. data/test/acceptance/suspend_test.rb +56 -0
  51. data/test/acceptance/up_basic_test.rb +58 -0
  52. data/test/acceptance/up_with_box_url.rb +40 -0
  53. data/test/acceptance/vagrant_test.rb +47 -0
  54. data/test/acceptance/version_test.rb +20 -0
  55. data/test/buildbot/README.md +72 -0
  56. data/test/buildbot/buildbot_config/__init__.py +0 -0
  57. data/test/buildbot/buildbot_config/config/__init__.py +0 -0
  58. data/test/buildbot/buildbot_config/config/loader.py +24 -0
  59. data/test/buildbot/buildbot_config/config/master.py +24 -0
  60. data/test/buildbot/buildbot_config/config/slave.py +22 -0
  61. data/test/buildbot/buildbot_config/master/__init__.py +6 -0
  62. data/test/buildbot/buildbot_config/master/builders.py +78 -0
  63. data/test/buildbot/buildbot_config/master/buildsteps.py +100 -0
  64. data/test/buildbot/buildbot_config/master/change_sources.py +8 -0
  65. data/test/buildbot/buildbot_config/master/schedulers.py +32 -0
  66. data/test/buildbot/buildbot_config/master/slaves.py +60 -0
  67. data/test/buildbot/buildbot_config/master/status.py +52 -0
  68. data/test/buildbot/master/Makefile.sample +28 -0
  69. data/test/buildbot/master/buildbot.tac +36 -0
  70. data/test/buildbot/master/master.cfg +67 -0
  71. data/test/buildbot/master/public_html/bg_gradient.jpg +0 -0
  72. data/test/buildbot/master/public_html/default.css +545 -0
  73. data/test/buildbot/master/public_html/favicon.ico +0 -0
  74. data/test/buildbot/master/public_html/robots.txt +10 -0
  75. data/test/buildbot/master/public_html/static/css/bootstrap-1.4.0.min.css +356 -0
  76. data/test/buildbot/master/public_html/static/css/prettify.css +97 -0
  77. data/test/buildbot/master/public_html/static/css/syntax.css +60 -0
  78. data/test/buildbot/master/public_html/static/css/vagrant.base.css +205 -0
  79. data/test/buildbot/master/public_html/static/images/base_box_mac.jpg +0 -0
  80. data/test/buildbot/master/public_html/static/images/getting-started/success.jpg +0 -0
  81. data/test/buildbot/master/public_html/static/images/icons/error.png +0 -0
  82. data/test/buildbot/master/public_html/static/images/vagrant_chilling.png +0 -0
  83. data/test/buildbot/master/public_html/static/images/vagrant_holding.png +0 -0
  84. data/test/buildbot/master/public_html/static/images/vagrant_looking.png +0 -0
  85. data/test/buildbot/master/public_html/static/images/windows/alter_path.jpg +0 -0
  86. data/test/buildbot/master/public_html/static/images/windows/edit_path.jpg +0 -0
  87. data/test/buildbot/master/public_html/static/images/windows/environment_variables_button.jpg +0 -0
  88. data/test/buildbot/master/public_html/static/images/windows/port_and_ppk_path.jpg +0 -0
  89. data/test/buildbot/master/public_html/static/images/windows/ppk_selection.jpg +0 -0
  90. data/test/buildbot/master/public_html/static/images/windows/putty_first_screen.jpg +0 -0
  91. data/test/buildbot/master/public_html/static/images/windows/save_result.jpg +0 -0
  92. data/test/buildbot/master/public_html/static/images/windows/vbox_manage_default_location.jpg +0 -0
  93. data/test/buildbot/master/public_html/static/js/bootstrap-tabs.js +80 -0
  94. data/test/buildbot/master/public_html/static/js/jquery-1.7.min.js +4 -0
  95. data/test/buildbot/master/templates/authfail.html +9 -0
  96. data/test/buildbot/master/templates/build.html +205 -0
  97. data/test/buildbot/master/templates/builder.html +118 -0
  98. data/test/buildbot/master/templates/builders.html +33 -0
  99. data/test/buildbot/master/templates/buildslave.html +72 -0
  100. data/test/buildbot/master/templates/buildslaves.html +70 -0
  101. data/test/buildbot/master/templates/change.html +15 -0
  102. data/test/buildbot/master/templates/layouts/base.html +58 -0
  103. data/test/buildbot/master/templates/macros/box.html +37 -0
  104. data/test/buildbot/master/templates/macros/build_line.html +50 -0
  105. data/test/buildbot/master/templates/macros/change.html +81 -0
  106. data/test/buildbot/master/templates/macros/forms.html +300 -0
  107. data/test/buildbot/master/templates/root.html +42 -0
  108. data/test/buildbot/master/templates/waterfall.html +53 -0
  109. data/test/buildbot/requirements.txt +4 -0
  110. data/test/buildbot/scripts/deploy.sh +38 -0
  111. data/test/buildbot/scripts/setup.sh +107 -0
  112. data/test/buildbot/slave/buildbot.tac +43 -0
  113. data/test/buildbot/slave/info/admin +1 -0
  114. data/test/buildbot/slave/info/host +1 -0
  115. data/test/buildbot/tests/__init__.py +0 -0
  116. data/test/buildbot/tests/master/__init__.py +0 -0
  117. data/test/buildbot/tests/master/test_slaves.py +41 -0
  118. data/test/buildbot/vendor/choices-0.4.0.tar.gz +0 -0
  119. data/test/config/acceptance_boxes.yml +7 -0
  120. data/test/unit/test_helper.rb +4 -0
  121. data/test/unit/vagrant/action/box/download_test.rb +2 -2
  122. data/test/unit/vagrant/action/vm/check_box_test.rb +6 -1
  123. data/test/unit/vagrant/action/vm/share_folders_test.rb +1 -1
  124. data/test/unit/vagrant/command/init_test.rb +10 -0
  125. data/test/unit/vagrant/downloaders/http_test.rb +12 -1
  126. data/test/unit/vagrant/provisioners/chef_test.rb +7 -0
  127. data/test/unit/vagrant/ssh/session_test.rb +2 -2
  128. data/test/unit/vagrant/ssh_test.rb +5 -8
  129. data/vagrant.gemspec +6 -0
  130. metadata +195 -7
data/.gitignore CHANGED
@@ -2,6 +2,24 @@
2
2
  .DS_Store
3
3
 
4
4
  # Vagrant stuff
5
+ acceptance_config.yml
6
+ boxes/*
7
+ test/buildbot/config.cfg
8
+ test/buildbot/env
9
+ test/buildbot/master/http.log
10
+ test/buildbot/master/master.cfg.sample
11
+ test/buildbot/master/twistd.log
12
+ test/buildbot/master/twistd.pid
13
+ test/buildbot/master/state.sqlite
14
+ test/buildbot/master/osx-*/
15
+ test/buildbot/master/linux-*/
16
+ test/buildbot/master/win-*/
17
+ test/buildbot/slave/twistd.hostname
18
+ test/buildbot/slave/twistd.log
19
+ test/buildbot/slave/twistd.pid
20
+ test/buildbot/slave/osx-*/
21
+ test/buildbot/slave/linux-*/
22
+ test/buildbot/slave/win-*/
5
23
  Vagrantfile
6
24
  .vagrant
7
25
 
@@ -17,6 +35,9 @@ _site/*
17
35
  .yardoc/
18
36
  doc/
19
37
 
38
+ # Python
39
+ *.pyc
40
+
20
41
  # Rubinius
21
42
  *.rbc
22
43
 
@@ -1,3 +1,28 @@
1
+ ## 0.8.8 (December 1, 2011)
2
+
3
+ - Mount shared folders shortest to longest to avoid mounting
4
+ subfolders first. [GH-525]
5
+ - Support for basic HTTP auth in the URL for boxes.
6
+ - Solaris support for host only networks. [GH-533]
7
+ - `vagrant init` respects `Vagrant::Environment` cwd. [GH-528]
8
+ - `vagrant` commands will not output color when stdout is
9
+ not a TTY.
10
+ - Fix issue where `box_url` set with multiple VMs could cause issues. [GH-564]
11
+ - Chef provisioners no longer depend on a "v-root" share being
12
+ available. [GH-556]
13
+ - NFS should work for FreeBSD hosts now. [GH-510]
14
+ - SSH executed methods respect `config.ssh.max_tries`. [GH-508]
15
+ - `vagrant box add` now respects the "no_proxy" environmental variable.
16
+ [GH-502]
17
+ - Tweaks that should make "Waiting for VM to boot" slightly more
18
+ reliable.
19
+ - Add comments to Vagrantfile to make it detected as Ruby file for
20
+ `vi` and `emacs`. [GH-515]
21
+ - More correct guest addition version checking. [GH-514]
22
+ - Chef solo support on Windows is improved. [GH-542]
23
+ - Put encrypted data bag secret into `/tmp` by default so that
24
+ permissions are almost certainly guaranteed. [GH-512]
25
+
1
26
  ## 0.8.7 (September 13, 2011)
2
27
 
3
28
  - Fix regression with remote paths from chef-solo. [GH-431]
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Vagrant
2
2
 
3
3
  * Website: [http://vagrantup.com](http://vagrantup.com)
4
- * Source: [http://github.com/mitchellh/vagrant](http://github.com/mitchellh/vagrant)
4
+ * Source: [https://github.com/mitchellh/vagrant](https://github.com/mitchellh/vagrant)
5
5
  * IRC: `#vagrant` on Freenode
6
6
  * Mailing list: [Google Groups](http://groups.google.com/group/vagrant-up)
7
7
 
@@ -29,15 +29,11 @@ Note: The above `vagrant up` command will also trigger Vagrant to download the
29
29
  `lucid32` box via the specified URL. Vagrant only does this if it detects that
30
30
  the box doesn't already exist on your system.
31
31
 
32
- ## Getting Started Guide and Video
32
+ ## Getting Started Guide
33
33
 
34
34
  To learn how to build a fully functional rails development environment, view the
35
35
  [getting started guide](http://vagrantup.com/docs/getting-started/index.html).
36
36
 
37
- There is also a fairly short (12 minute) [getting started video](http://vimeo.com/9976342) which
38
- explains how to build a fully functional LAMP development environment, which
39
- covers a few parts of Vagrant in more detail than the website guide.
40
-
41
37
  ## Installing the Gem from Git
42
38
 
43
39
  If you want the bleeding edge version of Vagrant, we try to keep master pretty stable
@@ -47,15 +43,49 @@ and you're welcome to give it a shot. The following is an example showing how to
47
43
 
48
44
  ## Contributing to Vagrant
49
45
 
46
+ ### Dependencies and Unit Tests
47
+
50
48
  To hack on vagrant, you'll need [bundler](http://github.com/carlhuda/bundler) which can
51
- be installed with a simple `gem install bundler --pre`. Afterwords, do the following:
49
+ be installed with a simple `gem install bundler`. Afterwords, do the following:
52
50
 
53
51
  bundle install
54
52
  rake
55
53
 
56
- This will run the test suite, which should come back all green! Then you're good to go!
54
+ This will run the unit test suite, which should come back all green! Then you're good to go!
57
55
 
58
56
  If you want to run Vagrant without having to install the gem, you may use `bundle exec`,
59
57
  like so:
60
58
 
61
59
  bundle exec bin/vagrant help
60
+
61
+ ### Acceptance Tests
62
+
63
+ Vagrant also comes with an acceptance test suite which runs the system
64
+ end-to-end, without mocking out any dependencies. Note that this test
65
+ suite is **extremely slow**, with the test suite taking hours on even
66
+ a decent system. A CI will be setup in due time to run these tests
67
+ automatically. However, it is still useful to know how to run these
68
+ tests since it is often useful to run a single test if you're working
69
+ on a specific feature.
70
+
71
+ The acceptance tests have absolutely _zero_ dependence on the Vagrant
72
+ source. Instead, an external configuration file must be used to give
73
+ the acceptance tests some parameters (such as what Vagrant version is
74
+ running, where the Vagrant `vagrant` binary is, etc.). If you want to
75
+ run acceptance tests against source, or just want to see an example of
76
+ this file, you can generate it automatically for the source code:
77
+
78
+ rake acceptance:config
79
+
80
+ This will drop an `acceptance_config.yml` file in your working directory.
81
+ You can then run a specific acceptance test like so:
82
+
83
+ ACCEPTANCE_CONFIG=./acceptance_config.yml ruby test/acceptance/version_test.rb
84
+
85
+ That's it!
86
+
87
+ If you're developing an acceptance test and you're unsure why things
88
+ might be failing, you can also view log output for the acceptance tests,
89
+ which can be very verbose but are a great help in finding bugs:
90
+
91
+ ACCEPTANCE_LOGGING=debug ACCEPTANCE_CONFIG=./acceptance_config.yml ruby test/acceptance/version_test.rb
data/Rakefile CHANGED
@@ -1,11 +1,18 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
- require 'rake/testtask'
4
- Bundler::GemHelper.install_tasks
5
3
 
6
- task :default => :test
4
+ # Immediately sync all stdout so that tools like buildbot can
5
+ # immediately load in the output.
6
+ $stdout.sync = true
7
+ $stderr.sync = true
7
8
 
8
- Rake::TestTask.new do |t|
9
- t.libs << "test/unit"
10
- t.pattern = 'test/unit/**/*_test.rb'
9
+ # Load all the rake tasks from the "tasks" folder. This folder
10
+ # allows us to nicely separate rake tasks into individual files
11
+ # based on their role, which makes development and debugging easier
12
+ # than one monolithic file.
13
+ task_dir = File.expand_path("../tasks", __FILE__)
14
+ Dir["#{task_dir}/**/*.rake"].each do |task_file|
15
+ load task_file
11
16
  end
17
+
18
+ task :default => "test:unit"
@@ -9,7 +9,12 @@ begin
9
9
  env.logger.info("vagrant") { "`vagrant` invoked: #{ARGV.inspect}" }
10
10
 
11
11
  # Disable color if the proper argument was passed
12
- shell = ARGV.include?("--no-color") ? Thor::Shell::Basic.new : Thor::Base.shell.new
12
+ shell = nil
13
+ if !$stdout.tty? || ARGV.include?("--no-color")
14
+ shell = Thor::Shell::Basic.new
15
+ else
16
+ shell = Thor::Base.shell.new
17
+ end
13
18
 
14
19
  # Set the UI early in case any errors are raised, and load
15
20
  # the config immediately, so we gather any new commands from
@@ -8,8 +8,8 @@ Vagrant::Config.run do |config|
8
8
  config.ssh.host = "127.0.0.1"
9
9
  config.ssh.forwarded_port_key = "ssh"
10
10
  config.ssh.forwarded_port_destination = 22
11
- config.ssh.max_tries = 10
12
- config.ssh.timeout = 30
11
+ config.ssh.max_tries = 100
12
+ config.ssh.timeout = 7
13
13
  config.ssh.private_key_path = File.expand_path("keys/vagrant", Vagrant.source_root)
14
14
  config.ssh.forward_agent = false
15
15
  config.ssh.forward_x11 = false
@@ -26,13 +26,25 @@ module Vagrant
26
26
  end
27
27
 
28
28
  def instantiate_downloader
29
- @env["download.classes"].each do |klass|
30
- if klass.match?(@env["box"].uri)
29
+ # Assign to a temporary variable since this is easier to type out,
30
+ # since it is used so many times.
31
+ classes = @env["download.classes"]
32
+
33
+ # Find the class to use.
34
+ classes.each_index do |i|
35
+ klass = classes[i]
36
+
37
+ # Use the class if it matches the given URI or if this
38
+ # is the last class...
39
+ if classes.length == (i + 1) || klass.match?(@env["box"].uri)
31
40
  @env.ui.info I18n.t("vagrant.actions.box.download.with", :class => klass.to_s)
32
41
  @downloader = klass.new(@env)
42
+ break
33
43
  end
34
44
  end
35
45
 
46
+ # This line should never be reached, but we'll keep this here
47
+ # just in case for now.
36
48
  raise Errors::BoxDownloadUnknownType if !@downloader
37
49
 
38
50
  @downloader.prepare(@env["box"].uri)
@@ -14,10 +14,17 @@ module Vagrant
14
14
  box_url = env["config"].vm.box_url
15
15
  raise Errors::BoxSpecifiedDoesntExist, :name => box_name if !box_url
16
16
 
17
+ # Add the box then reload the box collection so that it becomes
18
+ # aware of it.
17
19
  env.ui.info I18n.t("vagrant.actions.vm.check_box.not_found", :name => box_name)
18
20
  Vagrant::Box.add(env.env, box_name, box_url)
19
21
  env["boxes"].reload!
20
- env.env.reload_config!
22
+
23
+ # Reload the configuration for all our VMs, since this box
24
+ # may be used for other VMs.
25
+ env.env.vms.each do |name, vm|
26
+ vm.env.reload_config!
27
+ end
21
28
  end
22
29
 
23
30
  @app.call(env)
@@ -16,10 +16,13 @@ module Vagrant
16
16
  if version.empty?
17
17
  env.ui.warn I18n.t("vagrant.actions.vm.check_guest_additions.not_detected")
18
18
  else
19
- # Strip the -OSE/_OSE off from the guest additions
20
- version = version.gsub(/[-_]ose/i, '')
19
+ # Strip the -OSE/_OSE off from the guest additions and the virtual box
20
+ # version since all the matters are that the version _numbers_ match up.
21
+ guest_version, vb_version = [version, VirtualBox.version].map do |v|
22
+ v.gsub(/[-_]ose/i, '')
23
+ end
21
24
 
22
- if version != VirtualBox.version
25
+ if guest_version != vb_version
23
26
  env.ui.warn(I18n.t("vagrant.actions.vm.check_guest_additions.version_mismatch",
24
27
  :guest_version => version,
25
28
  :virtualbox_version => VirtualBox.version))
@@ -51,7 +51,18 @@ module Vagrant
51
51
  @env.ui.info I18n.t("vagrant.actions.vm.share_folders.mounting")
52
52
 
53
53
  @env["vm"].ssh.execute do |ssh|
54
- shared_folders.each do |name, data|
54
+ # short guestpaths first, so we don't step on ourselves
55
+ folders = shared_folders.sort_by do |name, data|
56
+ if data[:guestpath]
57
+ data[:guestpath].length
58
+ else
59
+ # A long enough path to just do this at the end.
60
+ 10000
61
+ end
62
+ end
63
+
64
+ # Go through each folder and mount
65
+ folders.each do |name, data|
55
66
  if data[:guestpath]
56
67
  # Guest path specified, so mount the folder to specified point
57
68
  @env.ui.info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
@@ -7,7 +7,7 @@ module Vagrant
7
7
  register "init [box_name] [box_url]", "Initializes the current folder for Vagrant usage"
8
8
 
9
9
  def execute
10
- template "Vagrantfile.erb", "Vagrantfile"
10
+ template "Vagrantfile.erb", env.cwd.join("Vagrantfile")
11
11
  end
12
12
  end
13
13
  end
@@ -2,6 +2,7 @@ require 'net/http'
2
2
  require 'net/https'
3
3
  require 'open-uri'
4
4
  require 'uri'
5
+ require 'base64'
5
6
 
6
7
  module Vagrant
7
8
  module Downloaders
@@ -15,8 +16,9 @@ module Vagrant
15
16
  end
16
17
 
17
18
  def download!(source_url, destination_file)
18
- proxy_uri = URI.parse(ENV["http_proxy"] || "")
19
19
  uri = URI.parse(source_url)
20
+ proxy_uri = resolve_proxy(uri)
21
+
20
22
  http = Net::HTTP.new(uri.host, uri.port, proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
21
23
 
22
24
  if uri.scheme == "https"
@@ -27,7 +29,12 @@ module Vagrant
27
29
  http.start do |h|
28
30
  env.ui.info I18n.t("vagrant.downloaders.http.download", :url => source_url)
29
31
 
30
- h.request_get(uri.request_uri) do |response|
32
+ headers = nil
33
+ if uri.user && uri.password
34
+ headers = {'Authorization' => 'Basic ' + Base64.encode64(uri.user + ':' + uri.password)}
35
+ end
36
+
37
+ h.request_get(uri.request_uri, headers) do |response|
31
38
  if response.is_a?(Net::HTTPRedirection)
32
39
  # Follow the HTTP redirect.
33
40
  # TODO: Error on some redirect limit
@@ -65,6 +72,26 @@ module Vagrant
65
72
  rescue SocketError
66
73
  raise Errors::DownloaderHTTPSocketError
67
74
  end
75
+
76
+ private
77
+
78
+ # This method respects the "http_proxy" and "no_proxy" environmental
79
+ # variables so that HTTP proxies can properly be used with Vagrant.
80
+ def resolve_proxy(source_uri)
81
+ proxy_string = ENV["http_proxy"] || ""
82
+ if !proxy_string.empty? && ENV.has_key?("no_proxy")
83
+ # Respect the "no_proxy" environmental variable which contains a list
84
+ # of hosts that a proxy should not be used for.
85
+ ENV["no_proxy"].split(",").each do |host|
86
+ if source_uri.host =~ /#{Regexp.quote(host.strip)}$/
87
+ proxy_string = ""
88
+ break
89
+ end
90
+ end
91
+ end
92
+
93
+ URI.parse(proxy_string)
94
+ end
68
95
  end
69
96
  end
70
97
  end
@@ -3,6 +3,7 @@ module Vagrant
3
3
  autoload :Base, 'vagrant/hosts/base'
4
4
  autoload :Arch, 'vagrant/hosts/arch'
5
5
  autoload :BSD, 'vagrant/hosts/bsd'
6
+ autoload :FreeBSD,'vagrant/hosts/freebsd'
6
7
  autoload :Fedora, 'vagrant/hosts/fedora'
7
8
  autoload :Linux, 'vagrant/hosts/linux'
8
9
  end
@@ -8,6 +8,7 @@ module Vagrant
8
8
  include Util::Retryable
9
9
 
10
10
  def self.distro_dispatch
11
+ return FreeBSD if Util::Platform.freebsd?
11
12
  return self if Util::Platform.darwin? || Util::Platform.bsd?
12
13
  end
13
14
 
@@ -0,0 +1,51 @@
1
+ require 'vagrant/util/platform'
2
+
3
+ module Vagrant
4
+ module Hosts
5
+ # Represents a FreeBSD host
6
+ class FreeBSD < BSD
7
+ include Util
8
+ include Util::Retryable
9
+
10
+ def nfs_export(ip, folders)
11
+ output = TemplateRenderer.render('nfs/exports',
12
+ :uuid => env.vm.uuid,
13
+ :ip => ip,
14
+ :folders => folders)
15
+
16
+ # The sleep ensures that the output is truly flushed before any `sudo`
17
+ # commands are issued.
18
+ env.ui.info I18n.t("vagrant.hosts.bsd.nfs_export.prepare")
19
+ sleep 0.5
20
+
21
+ output.split("\n").each do |line|
22
+ # This should only ask for administrative permission once, even
23
+ # though its executed in multiple subshells.
24
+ line = line.gsub('"', '\"')
25
+ system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
26
+ end
27
+
28
+ # We run restart here instead of "update" just in case nfsd
29
+ # is not starting
30
+ system("sudo /etc/rc.d/mountd onereload")
31
+ end
32
+
33
+ end
34
+
35
+ def nfs_cleanup
36
+ return if !File.exist?("/etc/exports")
37
+
38
+ retryable(:tries => 10, :on => TypeError) do
39
+ system("cat /etc/exports | grep 'VAGRANT-BEGIN: #{env.vm.uuid}' > /dev/null 2>&1")
40
+
41
+ if $?.to_i == 0
42
+ # Use sed to just strip out the block of code which was inserted
43
+ # by Vagrant
44
+ system("sudo sed -e '/^# VAGRANT-BEGIN: #{env.vm.uuid}/,/^# VAGRANT-END: #{env.vm.uuid}/ d' -ibak /etc/exports")
45
+ end
46
+
47
+ system("sudo /etc/rc.d/mountd onereload")
48
+ end
49
+ end
50
+ end
51
+ end
@@ -56,11 +56,12 @@ module Vagrant
56
56
  def setup_json
57
57
  env.ui.info I18n.t("vagrant.provisioners.chef.json")
58
58
 
59
- # Set up initial configuration
60
- data = {
61
- :config => env.config.to_hash,
62
- :directory => env.config.vm.shared_folders["v-root"][:guestpath],
63
- }
59
+ # Set up our configuration that is passed to the attributes by default
60
+ data = { :config => env.config.to_hash }
61
+
62
+ # Add our default share directory if it exists
63
+ default_share = env.config.vm.shared_folders["v-root"]
64
+ data[:directory] = default_share[:guestpath] if default_share
64
65
 
65
66
  # And wrap it under the "vagrant" namespace
66
67
  data = { :vagrant => data }
@@ -26,7 +26,7 @@ module Vagrant
26
26
  @file_cache_path = "/srv/chef/file_store"
27
27
  @file_backup_path = "/srv/chef/cache"
28
28
  @encrypted_data_bag_secret_key_path = nil
29
- @encrypted_data_bag_secret = "/etc/chef/encrypted_data_bag_secret"
29
+ @encrypted_data_bag_secret = "/tmp/encrypted_data_bag_secret"
30
30
  end
31
31
 
32
32
  def validate(errors)