core: box names with colons work on Windows [GH-4100]
This commit is contained in:
parent
27bf597214
commit
15f1823d5c
|
@ -26,6 +26,7 @@ BUG FIXES:
|
||||||
- core: Fix encoding issues with Windows. There are still some outlying
|
- core: Fix encoding issues with Windows. There are still some outlying
|
||||||
but this fixes a few. [GH-4159]
|
but this fixes a few. [GH-4159]
|
||||||
- core: Fix crash case when destroying with an invalid provisioner. [GH-4281]
|
- core: Fix crash case when destroying with an invalid provisioner. [GH-4281]
|
||||||
|
- core: Box names with colons work on Windows. [GH-4100]
|
||||||
- commands/package: base package won't crash with exception [GH-4017]
|
- commands/package: base package won't crash with exception [GH-4017]
|
||||||
- commands/rsync-auto: Destroyed machines won't raise exceptions. [GH-4031]
|
- commands/rsync-auto: Destroyed machines won't raise exceptions. [GH-4031]
|
||||||
- communicators/ssh: Nicer error if remote unexpectedly disconects. [GH-4038]
|
- communicators/ssh: Nicer error if remote unexpectedly disconects. [GH-4038]
|
||||||
|
|
|
@ -4,6 +4,7 @@ require "tmpdir"
|
||||||
|
|
||||||
require "log4r"
|
require "log4r"
|
||||||
|
|
||||||
|
require "vagrant/util/platform"
|
||||||
require "vagrant/util/subprocess"
|
require "vagrant/util/subprocess"
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
|
@ -349,12 +350,18 @@ module Vagrant
|
||||||
# @param [String] name
|
# @param [String] name
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def dir_name(name)
|
def dir_name(name)
|
||||||
name.gsub("/", "-VAGRANTSLASH-")
|
name = name.dup
|
||||||
|
name.gsub!(":", "-VAGRANTCOLON-") if Util::Platform.windows?
|
||||||
|
name.gsub!("/", "-VAGRANTSLASH-")
|
||||||
|
name
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the directory name for the box cleaned up
|
# Returns the directory name for the box cleaned up
|
||||||
def undir_name(name)
|
def undir_name(name)
|
||||||
name.gsub("-VAGRANTSLASH-", "/")
|
name = name.dup
|
||||||
|
name.gsub!("-VAGRANTCOLON-", ":")
|
||||||
|
name.gsub!("-VAGRANTSLASH-", "/")
|
||||||
|
name
|
||||||
end
|
end
|
||||||
|
|
||||||
# This checks if the given directory represents a V1 box on the
|
# This checks if the given directory represents a V1 box on the
|
||||||
|
|
|
@ -26,7 +26,7 @@ describe Vagrant::BoxCollection do
|
||||||
environment.box3("foo", "1.0", :vmware)
|
environment.box3("foo", "1.0", :vmware)
|
||||||
environment.box3("bar", "0", :ec2)
|
environment.box3("bar", "0", :ec2)
|
||||||
environment.box3("foo-VAGRANTSLASH-bar", "1.0", :virtualbox)
|
environment.box3("foo-VAGRANTSLASH-bar", "1.0", :virtualbox)
|
||||||
environment.box3("foo:bar", "1.0", :virtualbox)
|
environment.box3("foo-VAGRANTCOLON-colon", "1.0", :virtualbox)
|
||||||
|
|
||||||
# Verify some output
|
# Verify some output
|
||||||
results = subject.all
|
results = subject.all
|
||||||
|
@ -35,7 +35,7 @@ describe Vagrant::BoxCollection do
|
||||||
expect(results.include?(["foo", "1.0", :vmware])).to be
|
expect(results.include?(["foo", "1.0", :vmware])).to be
|
||||||
expect(results.include?(["bar", "0", :ec2])).to be
|
expect(results.include?(["bar", "0", :ec2])).to be
|
||||||
expect(results.include?(["foo/bar", "1.0", :virtualbox])).to be
|
expect(results.include?(["foo/bar", "1.0", :virtualbox])).to be
|
||||||
expect(results.include?(["foo:bar", "1.0", :virtualbox])).to be
|
expect(results.include?(["foo:colon", "1.0", :virtualbox])).to be
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not raise an exception when a file appears in the boxes dir' do
|
it 'does not raise an exception when a file appears in the boxes dir' do
|
||||||
|
|
Loading…
Reference in New Issue