kernel/v2: clone option

This commit is contained in:
Mitchell Hashimoto 2015-10-08 11:37:35 -04:00
parent 44d484e2e0
commit 06f8595bc0
3 changed files with 14 additions and 0 deletions

View File

@ -29,6 +29,7 @@ module VagrantPlugins
attr_accessor :box_download_client_cert
attr_accessor :box_download_insecure
attr_accessor :box_download_location_trusted
attr_accessor :clone
attr_accessor :communicator
attr_accessor :graceful_halt_timeout
attr_accessor :guest
@ -54,6 +55,7 @@ module VagrantPlugins
@box_download_location_trusted = UNSET_VALUE
@box_url = UNSET_VALUE
@box_version = UNSET_VALUE
@clone = UNSET_VALUE
@communicator = UNSET_VALUE
@graceful_halt_timeout = UNSET_VALUE
@guest = UNSET_VALUE
@ -367,6 +369,7 @@ module VagrantPlugins
@box_download_location_trusted = false if @box_download_location_trusted == UNSET_VALUE
@box_url = nil if @box_url == UNSET_VALUE
@box_version = nil if @box_version == UNSET_VALUE
@clone = nil if @clone == UNSET_VALUE
@communicator = nil if @communicator == UNSET_VALUE
@graceful_halt_timeout = 60 if @graceful_halt_timeout == UNSET_VALUE
@guest = nil if @guest == UNSET_VALUE
@ -558,6 +561,10 @@ module VagrantPlugins
errors << I18n.t("vagrant.config.vm.box_missing")
end
if box && clone
errors << I18n.t("vagrant.config.vm.clone_and_box")
end
errors << I18n.t("vagrant.config.vm.hostname_invalid_characters") if \
@hostname && @hostname !~ /^[a-z0-9][-.a-z0-9]*$/i

View File

@ -1404,6 +1404,7 @@ en:
box_download_checksum_notblank: |-
Checksum specified but must also specify "box_download_checksum_type"
box_missing: "A box must be specified."
clone_and_box: "Only one of clone or box can be specified."
hostname_invalid_characters: |-
The hostname set for the VM should only contain letters, numbers,
hyphens or dots. It cannot start with a hyphen or dot.

View File

@ -65,6 +65,12 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
subject.finalize!
assert_valid
end
it "is invalid if clone is set" do
subject.clone = "foo"
subject.finalize!
assert_invalid
end
end
context "#box_check_update" do