vagrant 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,15 +1,22 @@
1
+ # OS-specific
1
2
  .DS_Store
2
- pkg/*
3
+
4
+ # Vagrant stuff
3
5
  Vagrantfile
4
6
  .vagrant
7
+
8
+ # Bundler/Rubygems
5
9
  .bundle
6
- cookbooks/*
10
+ pkg/*
11
+ tags
12
+ Gemfile.lock
13
+ test/tmp/
14
+
15
+ # Documentation
7
16
  _site/*
8
- !templates/*
9
- *.org
10
17
  .yardoc/
11
18
  doc/
12
- tags
13
- Gemfile.lock
19
+
20
+ # IDE junk
14
21
  .idea/*
15
22
  *.iml
@@ -1,4 +1,14 @@
1
- ## 0.8.1 (unreleased)
1
+ ## 0.8.2 (July 22, 2011)
2
+
3
+ - Fix issue with SSH disconnects not reconnecting.
4
+ - Fix chef solo simply not working with roles/data bags. [GH-425]
5
+ - Multiple chef solo provisioners now work together.
6
+ - Update Puppet provisioner so no deprecation warning is shown. [GH-421]
7
+ - Removed error on "provisioner=" in config, as this has not existed
8
+ for some time now.
9
+ - Add better validation for networking.
10
+
11
+ ## 0.8.1 (July 20, 2011)
2
12
 
3
13
  - Repush of 0.8.0 to fix a Ruby 1.9.2 RubyGems issue.
4
14
 
@@ -2,6 +2,7 @@ Vagrant::Config.run do |config|
2
2
  # default config goes here
3
3
  config.vagrant.dotfile_name = ".vagrant"
4
4
  config.vagrant.host = :detect
5
+ config.vagrant.ssh_session_cache = false
5
6
 
6
7
  config.ssh.username = "vagrant"
7
8
  config.ssh.host = "127.0.0.1"
@@ -5,6 +5,7 @@ module Vagrant
5
5
 
6
6
  attr_accessor :dotfile_name
7
7
  attr_accessor :host
8
+ attr_accessor :ssh_session_cache
8
9
 
9
10
  def validate(errors)
10
11
  [:dotfile_name, :host].each do |field|
@@ -67,13 +67,6 @@ module Vagrant
67
67
  @provisioners << Provisioner.new(top, name, options, &block)
68
68
  end
69
69
 
70
- # This shows an error message to smooth the transition for the
71
- # backwards incompatible provisioner syntax change introduced
72
- # in Vagrant 0.7.0.
73
- def provisioner=(_value)
74
- raise Errors::VagrantError, :_key => :provisioner_equals_not_supported
75
- end
76
-
77
70
  def customize(&block)
78
71
  push_proc(&block)
79
72
  end
@@ -126,6 +119,21 @@ module Vagrant
126
119
  end
127
120
  end
128
121
 
122
+ # Validate some basic networking
123
+ network_options.each do |options|
124
+ next if !options
125
+
126
+ ip = options[:ip].split(".")
127
+
128
+ if ip.length != 4
129
+ errors.add(I18n.t("vagrant.config.vm.network_ip_invalid",
130
+ :ip => options[:ip]))
131
+ elsif ip.last == "1"
132
+ errors.add(I18n.t("vagrant.config.vm.network_ip_ends_one",
133
+ :ip => options[:ip]))
134
+ end
135
+ end
136
+
129
137
  # Each provisioner can validate itself
130
138
  provisioners.each do |prov|
131
139
  # TODO: Remove at some point
@@ -4,6 +4,8 @@ module Vagrant
4
4
  class ChefSolo < Chef
5
5
  register :chef_solo
6
6
 
7
+ extend Util::Counter
8
+
7
9
  class Config < Chef::Config
8
10
  attr_accessor :cookbooks_path
9
11
  attr_accessor :roles_path
@@ -56,7 +58,6 @@ module Vagrant
56
58
  # path element which contains the folder location (:host or :vm)
57
59
  paths = [paths] if paths.is_a?(String) || paths.first.is_a?(Symbol)
58
60
 
59
- index = 0
60
61
  paths.map do |path|
61
62
  path = [:host, path] if !path.is_a?(Array)
62
63
  type, path = path
@@ -65,8 +66,7 @@ module Vagrant
65
66
  # or VM path.
66
67
  local_path = nil
67
68
  local_path = File.expand_path(path, env.root_path) if type == :host
68
- remote_path = type == :host ? "#{config.provisioning_path}/chef-solo-#{index}" : path
69
- index += 1
69
+ remote_path = type == :host ? "#{config.provisioning_path}/chef-solo-#{self.class.get_and_update_counter}" : path
70
70
 
71
71
  # Return the result
72
72
  [type, local_path, remote_path]
@@ -76,12 +76,10 @@ module Vagrant
76
76
  # Shares the given folders with the given prefix. The folders should
77
77
  # be of the structure resulting from the `expanded_folders` function.
78
78
  def share_folders(prefix, folders)
79
- index = 0
80
79
  folders.each do |type, local_path, remote_path|
81
80
  if type == :host
82
- env.config.vm.share_folder("v-#{prefix}-#{index}",
81
+ env.config.vm.share_folder("v-#{prefix}-#{self.class.get_and_update_counter}",
83
82
  remote_path, local_path, :nfs => config.nfs)
84
- index += 1
85
83
  end
86
84
  end
87
85
  end
@@ -118,7 +118,7 @@ module Vagrant
118
118
  options = options.join(" ")
119
119
 
120
120
  commands = ["cd #{manifests_guest_path}",
121
- "puppet #{options}"]
121
+ "puppet apply #{options}"]
122
122
 
123
123
  env.ui.info I18n.t("vagrant.provisioners.puppet.running_puppet", :manifest => config.computed_manifest_file)
124
124
 
@@ -73,8 +73,22 @@ module Vagrant
73
73
  opts[:port] ||= port
74
74
 
75
75
  # Check if we have a currently open SSH session which has the
76
- # same options, and use that if possible
77
- session, options = @current_session
76
+ # same options, and use that if possible.
77
+ #
78
+ # NOTE: This is experimental and unstable. Therefore it is disabled
79
+ # by default.
80
+ session, options = nil
81
+ session, options = @current_session if env.config.vagrant.ssh_session_cache
82
+
83
+ if session && options == opts
84
+ # Verify that the SSH session is still valid
85
+ begin
86
+ session.exec!("echo foo")
87
+ rescue IOError
88
+ # Reset the session, we need to reconnect
89
+ session = nil
90
+ end
91
+ end
78
92
 
79
93
  if !session || options != opts
80
94
  env.logger.info("ssh") { "Connecting to SSH: #{env.config.ssh.host} #{opts[:port]}" }
@@ -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.8.1"
5
+ VERSION = "0.8.2"
6
6
  end
@@ -48,31 +48,6 @@ en:
48
48
  multi_vm_required: "A multi-vm environment is required for name specification to this command."
49
49
  multi_vm_target_required: "`vagrant %{command}` requires a specific VM name to target in a multi-VM environment."
50
50
  no_env: "No Vagrant environment detected. Run `vagrant init` to set one up."
51
- provisioner_equals_not_supported: |-
52
- The `config.vm.provisioner =` syntax has been removed in Vagrant 0.7.0.
53
- Please change your provisioners to use the new syntax described below.
54
- All of these changes are reflected on the Vagrant website as well.
55
-
56
- Before:
57
-
58
- config.vm.provisioner = :chef_solo
59
- config.chef.cookbooks_path = "my_cookbooks"
60
- config.chef.add_recipe "apache"
61
-
62
- After:
63
-
64
- config.vm.provision :chef_solo, :cookbooks_path => "my_cookbooks",
65
- :run_list => ["recipe[apache]"]
66
-
67
- Instead of just a hash, you may use a block as well to get access to the
68
- configuration object:
69
-
70
- config.vm.provision :chef_solo do |chef|
71
- chef.cookbooks_path = "my_cookbooks"
72
- chef.add_recipe "apache"
73
- end
74
-
75
- This error message will be removed in later versions of Vagrant.
76
51
  ssh_authentication_failed: |-
77
52
  SSH authentication failed! This is typically caused by the public/private
78
53
  keypair for the SSH user not being properly set on the guest VM. Please
@@ -190,6 +165,10 @@ en:
190
165
  boot_mode_invalid: "Boot mode must be one of: vrdp or gui"
191
166
  box_missing: "A box must be specified."
192
167
  box_not_found: "The box '%{name}' could not be found."
168
+ network_ip_invalid: "The host only network IP '%{ip}' is invalid."
169
+ network_ip_ends_one: |-
170
+ The host only network IP '%{ip}' must not end in a 1, as this
171
+ is reserved for the host machine.
193
172
  shared_folder_hostpath_missing: "Shared folder host path for '%{name}' doesn't exist: %{path}"
194
173
  shared_folder_nfs_owner_group: |-
195
174
  Shared folder '%{name}': NFS does not support the owner/group settings.
@@ -131,7 +131,7 @@ class NetworkVMActionTest < Test::Unit::TestCase
131
131
 
132
132
  adapter.expects(:enabled=).with(true)
133
133
  adapter.expects(:attachment_type=).with(:host_only).once
134
- adapter.expects(:host_interface=).with(@network_name).once
134
+ adapter.expects(:host_only_interface=).with(@network_name).once
135
135
 
136
136
  if options[:mac]
137
137
  adapter.expects(:mac_address=).with(options[:mac].gsub(':', '')).once
@@ -53,12 +53,4 @@ class ConfigVMTest < Test::Unit::TestCase
53
53
  assert @config.proc_stack.include?(proc)
54
54
  end
55
55
  end
56
-
57
- context "deprecated config" do
58
- should "raise an error for provisioner=" do
59
- assert_raises(Vagrant::Errors::VagrantError) {
60
- @config.provisioner = :chef_solo
61
- }
62
- end
63
- end
64
56
  end
@@ -11,11 +11,11 @@ class EnvironmentTest < Test::Unit::TestCase
11
11
 
12
12
  context "class method check virtualbox version" do
13
13
  setup do
14
- VirtualBox.stubs(:version).returns("4.0.0")
14
+ VirtualBox.stubs(:version).returns("4.1.0")
15
15
  end
16
16
 
17
17
  should "not error and exit if everything is good" do
18
- VirtualBox.expects(:version).returns("4.0.0")
18
+ VirtualBox.expects(:version).returns("4.1.0")
19
19
  assert_nothing_raised { @klass.check_virtualbox! }
20
20
  end
21
21
 
@@ -52,9 +52,17 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
52
52
  should "expand host folders properly" do
53
53
  path = "foo"
54
54
  local_path = File.expand_path(path, @env.root_path)
55
- remote_path = "#{@action.config.provisioning_path}/chef-solo-0"
55
+ remote_path = "#{@action.config.provisioning_path}/chef-solo-1"
56
56
  assert_equal [[:host, local_path, remote_path]], @action.expanded_folders([:host, path])
57
57
  end
58
+
59
+ should "share roles and cookbooks in different folders" do
60
+ local_roles_path = File.expand_path('roles',@env.root_path)
61
+ local_cookbooks_path = File.expand_path('cookbooks',@env.root_path)
62
+ remote_roles_path = @action.expanded_folders([:host,local_roles_path])[0][2]
63
+ remote_cookbooks_path = @action.expanded_folders([:host,local_cookbooks_path])[0][2]
64
+ assert_not_equal remote_roles_path, remote_cookbooks_path
65
+ end
58
66
  end
59
67
 
60
68
  context "guest paths" do
@@ -155,25 +155,25 @@ class PuppetProvisionerTest < Test::Unit::TestCase
155
155
  end
156
156
 
157
157
  should "cd into the pp_path directory and run puppet" do
158
- expect_puppet_command("puppet #{@config.computed_manifest_file}")
158
+ expect_puppet_command("puppet apply #{@config.computed_manifest_file}")
159
159
  @action.run_puppet_client
160
160
  end
161
161
 
162
162
  should "cd into the pp_path directory and run puppet with given options when given as an array" do
163
163
  @config.options = ["--modulepath", "modules", "--verbose"]
164
- expect_puppet_command("puppet --modulepath modules --verbose #{@config.computed_manifest_file}")
164
+ expect_puppet_command("puppet apply --modulepath modules --verbose #{@config.computed_manifest_file}")
165
165
  @action.run_puppet_client
166
166
  end
167
167
 
168
168
  should "cd into the pp_path directory and run puppet with the options when given as a string" do
169
169
  @config.options = "--modulepath modules --verbose"
170
- expect_puppet_command("puppet --modulepath modules --verbose #{@config.computed_manifest_file}")
170
+ expect_puppet_command("puppet apply --modulepath modules --verbose #{@config.computed_manifest_file}")
171
171
  @action.run_puppet_client
172
172
  end
173
173
 
174
174
  should "cd into the pp_path and run puppet with module paths if set" do
175
175
  @config.module_path = "foo"
176
- expect_puppet_command("puppet --modulepath '#{File.join(@config.pp_path, 'modules-0')}' #{@config.computed_manifest_file}")
176
+ expect_puppet_command("puppet apply --modulepath '#{File.join(@config.pp_path, 'modules-0')}' #{@config.computed_manifest_file}")
177
177
 
178
178
  @action.set_module_paths
179
179
  @action.run_puppet_client
@@ -12,7 +12,7 @@ class SshTest < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  setup do
15
- VirtualBox.stubs(:version).returns("4.0.0")
15
+ VirtualBox.stubs(:version).returns("4.1.0")
16
16
  end
17
17
 
18
18
  context "connecting to external SSH" do
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency "net-scp", "~> 1.0.4"
22
22
  s.add_dependency "i18n", "~> 0.5.0"
23
23
  s.add_dependency "thor", "~> 0.14.6"
24
- s.add_dependency "virtualbox", "~> 0.9.0"
24
+ s.add_dependency "virtualbox", "~> 0.9.1"
25
25
 
26
26
  s.add_development_dependency "rake"
27
27
  s.add_development_dependency "contest", ">= 0.1.2"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 1
9
- version: 0.8.1
8
+ - 2
9
+ version: 0.8.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mitchell Hashimoto
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-20 00:00:00 -07:00
18
+ date: 2011-07-22 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -124,8 +124,8 @@ dependencies:
124
124
  segments:
125
125
  - 0
126
126
  - 9
127
- - 0
128
- version: 0.9.0
127
+ - 1
128
+ version: 0.9.1
129
129
  requirement: *id008
130
130
  name: virtualbox
131
131
  prerelease: false