vagrantup 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5792b5a7710c5518a4358d532a1746f69e612bd6
4
- data.tar.gz: cb084ce778ebfd587cb8d034d1dccde6e2fc71b6
3
+ metadata.gz: e5706bfea6f6e245dad4f0d14273def52e00968e
4
+ data.tar.gz: dc4d88b8301f749d5ca14848ff4b5614648552c2
5
5
  SHA512:
6
- metadata.gz: a53f20097b36bbb85ac603e5ed8eb3a33ab03ff1f8ce1e505ffe096d7316d36f46eedd22e0e7a08c1cab6c3a24155ef20efcc84bb5da12be7ce7b77711ed8c3b
7
- data.tar.gz: 82d177f84a3c71102b174f7a88d890e7e2a57ae93a0aa01163fda1923be2a7a1a439e398bf9c87b5d17adf5491009e35e6972238f5028c85e6ed7a837ea7f18b
6
+ metadata.gz: b53c3f4a8bf846a9e975f86b0026f0819b78fda92e8a3edee4c36f5089c3efa66db3df8728652aa643589cae89bafbfb20f6006c84f33bae95f7e45c8b8798c6
7
+ data.tar.gz: 1aa2d1992525b8a01deeb7ba6ce94e9b378ba0ab5d01c3c282cfe6c367286886d8cab61830e6621dcec0d34e2ceea9c757be55b163d67a36ce5a37a975663d8a
@@ -1,3 +1,33 @@
1
+ ## 1.1.1 (March 18, 2013)
2
+
3
+ IMPROVEMENTS:
4
+
5
+ - Don't load plugins on any `vagrant plugin` command, so that errors
6
+ are avoided. [GH-1418]
7
+ - An error will be shown if you forward a port to the same host port
8
+ multiple times.
9
+ - Automatically convert network, provider, and provisioner names to
10
+ symbols internally in case people define them as strings.
11
+ - Using newer versions of net-ssh and net-scp. [GH-1436]
12
+
13
+ BUG FIXES:
14
+
15
+ - Quote keys to StringBlockEditor so keys with spaces, parens, and
16
+ so on work properly.
17
+ - When there is no route to host for SSH, re-establish a new connection.
18
+ - `vagrant package` once again works, no more nil error. [GH-1423]
19
+ - Human friendly error when "metadata.json" is missing in a box.
20
+ - Don't use the full path to the manifest file with the Puppet provisioner
21
+ because it exposes a bug with Puppet path lookup on VMware.
22
+ - Fix bug in VirtualBox provider where port forwarding just didn't work if
23
+ you attempted to forward to a port under 1024. [GH-1421]
24
+ - Fix cross-device box adds for Windows. [GH-1424]
25
+ - Fix minor issues with defaults of configuration of the shell
26
+ provisioner.
27
+ - Fix Puppet server using "host_name" instead of "hostname" [GH-1444]
28
+ - Raise a proper error if no hostonly network is found for NFS with
29
+ VirtualBox. [GH-1437]
30
+
1
31
  ## 1.1.0 (March 14, 2013)
2
32
 
3
33
  BACKWARDS INCOMPATIBILITIES:
@@ -168,6 +168,12 @@ module Vagrant
168
168
  #
169
169
  # @param [String] name Name of the plugin to load.
170
170
  def self.require_plugin(name)
171
+ if ENV["VAGRANT_NO_PLUGINS"]
172
+ logger = Log4r::Logger.new("vagrant::root")
173
+ logger.warn("VAGRANT_NO_PLUGINS is set, not loading 3rd party plugin: #{name}")
174
+ return
175
+ end
176
+
171
177
  # Redirect stdout/stderr so that we can output it in our own way.
172
178
  previous_stderr = $stderr
173
179
  previous_stdout = $stdout
@@ -212,8 +218,8 @@ module Vagrant
212
218
  :plugin => name
213
219
  end
214
220
  ensure
215
- $stderr = previous_stderr
216
- $stdout = previous_stdout
221
+ $stderr = previous_stderr if previous_stderr
222
+ $stdout = previous_stdout if previous_stdout
217
223
  end
218
224
  end
219
225
 
@@ -22,7 +22,7 @@ module Vagrant
22
22
  @app = app
23
23
 
24
24
  env["package.files"] ||= {}
25
- env["package.output"] ||= env["global_config"].package.name
25
+ env["package.output"] ||= env[:global_config].package.name
26
26
  end
27
27
 
28
28
  def call(env)
@@ -43,7 +43,10 @@ module Vagrant
43
43
  @name = name
44
44
  @provider = provider
45
45
  @directory = directory
46
- @metadata = JSON.parse(directory.join("metadata.json").read)
46
+
47
+ metadata_file = directory.join("metadata.json")
48
+ raise Errors::BoxMetadataFileNotFound, :name => @name if !metadata_file.file?
49
+ @metadata = JSON.parse(directory.join("metadata.json").read)
47
50
 
48
51
  @logger = Log4r::Logger.new("vagrant::box")
49
52
  end
@@ -147,12 +147,16 @@ module Vagrant
147
147
  end
148
148
 
149
149
  # Move to final destination
150
- FileUtils.mv(temp_dir.to_s, final_dir.to_s)
151
-
152
- # Recreate the directory. This avoids a bug in Ruby where `mktmpdir`
153
- # cleanup doesn't check if the directory is already gone. Ruby bug
154
- # #6715: http://bugs.ruby-lang.org/issues/6715
155
- Dir.mkdir(temp_dir, 0700)
150
+ final_dir.mkpath
151
+
152
+ # Go through each child and copy them one-by-one. This avoids
153
+ # an issue where on Windows cross-device directory copies are
154
+ # failing for some reason. [GH-1424]
155
+ temp_dir.children(true).each do |f|
156
+ destination = final_dir.join(f.basename)
157
+ @logger.debug("Moving: #{f} => #{destination}")
158
+ FileUtils.mv(f, destination)
159
+ end
156
160
  end
157
161
 
158
162
  # Return the box
@@ -631,13 +631,6 @@ module Vagrant
631
631
  # Loads the Vagrant plugins by properly setting up RubyGems so that
632
632
  # our private gem repository is on the path.
633
633
  def load_plugins
634
- if ENV["VAGRANT_NO_PLUGINS"]
635
- # If this key exists, then we don't load any plugins. It is a "safe
636
- # mode" of sorts.
637
- @logger.warn("VAGRANT_NO_PLUGINS is set. Not loading 3rd party plugins.")
638
- return
639
- end
640
-
641
634
  # Add our private gem path to the gem path and reset the paths
642
635
  # that Rubygems knows about.
643
636
  ENV["GEM_PATH"] = "#{@gems_path}#{::File::PATH_SEPARATOR}#{ENV["GEM_PATH"]}"
@@ -99,6 +99,10 @@ module Vagrant
99
99
  error_key(:unknown_type, "vagrant.actions.box.download")
100
100
  end
101
101
 
102
+ class BoxMetadataFileNotFound < VagrantError
103
+ error_key(:box_metadata_file_not_found)
104
+ end
105
+
102
106
  class BoxNotFound < VagrantError
103
107
  error_key(:box_not_found)
104
108
  end
@@ -263,6 +267,10 @@ module Vagrant
263
267
  error_key(:nfs_no_host_ip)
264
268
  end
265
269
 
270
+ class NFSNoHostonlyNetwork < VagrantError
271
+ error_key(:nfs_no_hostonly_network)
272
+ end
273
+
266
274
  class NoEnvironmentError < VagrantError
267
275
  error_key(:no_env)
268
276
  end
@@ -44,12 +44,14 @@ module Vagrant
44
44
 
45
45
  # This deletes the block with the given key if it exists.
46
46
  def delete(key)
47
+ key = Regexp.quote(key)
47
48
  regexp = /^#\s*VAGRANT-BEGIN:\s*#{key}$.*^#\s*VAGRANT-END:\s*#{key}$\r?\n?/m
48
49
  @value.gsub!(regexp, "")
49
50
  end
50
51
 
51
52
  # This gets the value of the block with the given key.
52
53
  def get(key)
54
+ key = Regexp.quote(key)
53
55
  regexp = /^#\s*VAGRANT-BEGIN:\s*#{key}$\r?\n?(.*?)\r?\n?^#\s*VAGRANT-END:\s*#{key}$\r?\n?/m
54
56
  match = regexp.match(@value)
55
57
  return nil if !match
@@ -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 = "1.1.0"
5
+ VERSION = "1.1.1"
6
6
  end
@@ -126,6 +126,9 @@ module VagrantPlugins
126
126
  # socket.
127
127
  begin
128
128
  @connection.exec!("")
129
+ rescue Errno::EHOSTUNREACH
130
+ @logger.info("No route to host for connection. Not re-using.")
131
+ @connection = nil
129
132
  rescue IOError
130
133
  @logger.info("Connection has been closed. Not re-using.")
131
134
  @connection = nil
@@ -1,5 +1,6 @@
1
1
  require "pathname"
2
2
  require "securerandom"
3
+ require "set"
3
4
 
4
5
  require "vagrant"
5
6
  require "vagrant/config/v2/util"
@@ -137,19 +138,20 @@ module VagrantPlugins
137
138
  end
138
139
 
139
140
  # Merge in the latest settings and set the internal state
140
- @__networks[id] = [type, options]
141
+ @__networks[id] = [type.to_sym, options]
141
142
  end
142
143
 
143
144
  # Configures a provider for this VM.
144
145
  #
145
146
  # @param [Symbol] name The name of the provider.
146
147
  def provider(name, &block)
148
+ name = name.to_sym
147
149
  @__providers[name] ||= []
148
150
  @__providers[name] << block if block_given?
149
151
  end
150
152
 
151
153
  def provision(name, options=nil, &block)
152
- @provisioners << VagrantConfigProvisioner.new(name, options, &block)
154
+ @provisioners << VagrantConfigProvisioner.new(name.to_sym, options, &block)
153
155
  end
154
156
 
155
157
  def defined_vms
@@ -277,12 +279,23 @@ module VagrantPlugins
277
279
 
278
280
  # Validate networks
279
281
  has_fp_port_error = false
282
+ fp_host_ports = Set.new
283
+
280
284
  networks.each do |type, options|
281
285
  if type == :forwarded_port
282
286
  if !has_fp_port_error && (!options[:guest] || !options[:host])
283
287
  errors << I18n.t("vagrant.config.vm.network_fp_requires_ports")
284
288
  has_fp_port_error = true
285
289
  end
290
+
291
+ if options[:host]
292
+ if fp_host_ports.include?(options[:host])
293
+ errors << I18n.t("vagrant.config.vm.network_fp_host_not_unique",
294
+ :host => options[:host].to_s)
295
+ end
296
+
297
+ fp_host_ports.add(options[:host])
298
+ end
286
299
  end
287
300
  end
288
301
 
@@ -21,7 +21,7 @@ module VagrantPlugins
21
21
  env[:forwarded_ports].each do |fp|
22
22
  if fp.host_port <= 1024
23
23
  env[:ui].warn I18n.t("vagrant.actions.vm.forward_ports.privileged_ports")
24
- return
24
+ break
25
25
  end
26
26
  end
27
27
 
@@ -12,6 +12,8 @@ module VagrantPlugins
12
12
 
13
13
  env[:nfs_host_ip] = read_host_ip(env[:machine])
14
14
  env[:nfs_machine_ip] = read_machine_ip(env[:machine])
15
+
16
+ raise Errors::NFSNoHostonlyNetwork if !env[:nfs_machine_ip]
15
17
  end
16
18
 
17
19
  # Returns the IP address of the first host only network adapter
@@ -19,7 +19,7 @@ module VagrantPlugins
19
19
  root_path = @machine.env.root_path
20
20
  @expanded_manifests_path = @config.expanded_manifests_path(root_path)
21
21
  @expanded_module_paths = @config.expanded_module_paths(root_path)
22
- @manifest_file = File.join(manifests_guest_path, @config.manifest_file)
22
+ @manifest_file = @config.manifest_file
23
23
 
24
24
  # Setup the module paths
25
25
  @module_paths = []
@@ -29,7 +29,7 @@ module VagrantPlugins
29
29
  if config.puppet_node
30
30
  # If a node name is given, we use that directly for the certname
31
31
  cn = config.puppet_node
32
- elsif @machine.config.vm.host_name
32
+ elsif @machine.config.vm.hostname
33
33
  # If a host name is given, we explicitly set the certname to
34
34
  # nil so that the hostname becomes the cert name.
35
35
  cn = nil
@@ -7,7 +7,16 @@ module VagrantPlugins
7
7
  attr_accessor :args
8
8
 
9
9
  def initialize
10
- @upload_path = "/tmp/vagrant-shell"
10
+ @args = []
11
+ @inline = UNSET_VALUE
12
+ @path = UNSET_VALUE
13
+ @upload_path = UNSET_VALUE
14
+ end
15
+
16
+ def finalize!
17
+ @inline = nil if @inline == UNSET_VALUE
18
+ @path = nil if @path == UNSET_VALUE
19
+ @upload_path = "/tmp/vagrant-shell" if @upload_path == UNSET_VALUE
11
20
  end
12
21
 
13
22
  def validate(machine)
@@ -52,6 +52,15 @@ en:
52
52
  Active provider: %{active_provider}
53
53
  Requested provider: %{requested_provider}
54
54
  base_vm_not_found: The base VM with the name '%{name}' was not found.
55
+ box_metadata_file_not_found: |-
56
+ The "metadata.json" file for the box '%{name}' was not found.
57
+ Boxes require this file in order for Vagrant to determine the
58
+ provider it was made for. If you made the box, please add a
59
+ "metadata.json" file to it. If someone else made the box, please
60
+ notify the box creator that the box is corrupt. Documentation for
61
+ box file format can be found at the URL below:
62
+
63
+ http://docs.vagrantup.com/v2/boxes/format.html
55
64
  box_not_found: Box '%{name}' could not be found.
56
65
  box_provider_doesnt_match: |-
57
66
  The box you attempted to add doesn't match the provider you specified.
@@ -176,6 +185,10 @@ en:
176
185
  nfs_no_host_ip: |-
177
186
  No host IP was given to the Vagrant core NFS helper. This is
178
187
  an internal error that should be reported as a bug.
188
+ nfs_no_hostonly_network: |-
189
+ NFS requires a host-only network with a static IP to be created.
190
+ Please add a host-only network with a static IP to the machine
191
+ for NFS to work.
179
192
  no_env: |-
180
193
  A Vagrant environment is required to run this command. Run `vagrant init`
181
194
  to set one up in this directory, or change to a directory with a
@@ -447,6 +460,8 @@ en:
447
460
  nfs_requires_host: |-
448
461
  Using NFS shared folders requires a host to be specified
449
462
  using `config.vagrant.host`.
463
+ network_fp_host_not_unique: |-
464
+ Forwarded port '%{host}' (host port) is declared multiple times
450
465
  network_fp_requires_ports: |-
451
466
  Forwarded port definitions require a "host" and "guest" value
452
467
  shared_folder_hostpath_missing: |-
@@ -14,6 +14,8 @@ describe Vagrant::Box do
14
14
  let(:directory) { environment.box2("foo", :virtualbox) }
15
15
  let(:instance) { described_class.new(name, provider, directory) }
16
16
 
17
+ subject { described_class.new(name, provider, directory) }
18
+
17
19
  it "provides the name" do
18
20
  instance.name.should == name
19
21
  end
@@ -38,6 +40,17 @@ describe Vagrant::Box do
38
40
  instance.metadata.should == data
39
41
  end
40
42
 
43
+ context "without a metadata file" do
44
+ before :each do
45
+ directory.join("metadata.json").delete
46
+ end
47
+
48
+ it "should raise an exception" do
49
+ expect { subject }.
50
+ to raise_error(Vagrant::Errors::BoxMetadataFileNotFound)
51
+ end
52
+ end
53
+
41
54
  describe "destroying" do
42
55
  it "should destroy an existing box" do
43
56
  # Verify that our "box" exists
@@ -61,17 +61,25 @@ DATA
61
61
  # VAGRANT-BEGIN: bar
62
62
  content
63
63
  # VAGRANT-END: bar
64
+ # VAGRANT-BEGIN: /Users/studio/Projects (studio)/tubes/.vagrant/machines/web/vmware_fusion/vm.vmwarevm
65
+ complex
66
+ # VAGRANT-END: /Users/studio/Projects (studio)/tubes/.vagrant/machines/web/vmware_fusion/vm.vmwarevm
64
67
  DATA
65
68
  end
66
69
 
70
+ subject { described_class.new(data) }
71
+
67
72
  it "should get the value" do
68
- instance = described_class.new(data)
69
- instance.get("bar").should == "content"
73
+ subject.get("bar").should == "content"
70
74
  end
71
75
 
72
76
  it "should get nil for nonexistent values" do
73
- instance = described_class.new(data)
74
- instance.get("baz").should be_nil
77
+ subject.get("baz").should be_nil
78
+ end
79
+
80
+ it "should get complicated keys" do
81
+ result = subject.get("/Users/studio/Projects (studio)/tubes/.vagrant/machines/web/vmware_fusion/vm.vmwarevm")
82
+ result.should == "complex"
75
83
  end
76
84
  end
77
85
 
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.add_dependency "i18n", "~> 0.6.0"
20
20
  s.add_dependency "json", ">= 1.5.1", "< 1.8.0"
21
21
  s.add_dependency "log4r", "~> 1.1.9"
22
- s.add_dependency "net-ssh", "~> 2.2.2"
23
- s.add_dependency "net-scp", "~> 1.0.4"
22
+ s.add_dependency "net-ssh", "~> 2.6.6"
23
+ s.add_dependency "net-scp", "~> 1.1.0"
24
24
 
25
25
  s.add_development_dependency "rake"
26
26
  s.add_development_dependency "contest", ">= 0.1.2"
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.add_dependency "i18n", "~> 0.6.0"
20
20
  s.add_dependency "json", ">= 1.5.1", "< 1.8.0"
21
21
  s.add_dependency "log4r", "~> 1.1.9"
22
- s.add_dependency "net-ssh", "~> 2.2.2"
23
- s.add_dependency "net-scp", "~> 1.0.4"
22
+ s.add_dependency "net-ssh", "~> 2.6.6"
23
+ s.add_dependency "net-scp", "~> 1.1.0"
24
24
 
25
25
  s.add_development_dependency "rake"
26
26
  s.add_development_dependency "contest", ">= 0.1.2"
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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
@@ -93,28 +93,28 @@ dependencies:
93
93
  requirements:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: 2.2.2
96
+ version: 2.6.6
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ~>
102
102
  - !ruby/object:Gem::Version
103
- version: 2.2.2
103
+ version: 2.6.6
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: net-scp
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: 1.0.4
110
+ version: 1.1.0
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 1.0.4
117
+ version: 1.1.0
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: rake
120
120
  requirement: !ruby/object:Gem::Requirement