core: validate box_download_ca_cert_file, expand
This commit is contained in:
parent
d0f14250d6
commit
db9c8dd6b3
|
@ -44,7 +44,12 @@ module Vagrant
|
||||||
box_download_client_cert = env[:machine].config.vm.box_download_client_cert
|
box_download_client_cert = env[:machine].config.vm.box_download_client_cert
|
||||||
box_download_insecure = env[:machine].config.vm.box_download_insecure
|
box_download_insecure = env[:machine].config.vm.box_download_insecure
|
||||||
|
|
||||||
# TODO: expand ca cert path relative to root path
|
# Expand the CA cert file relative to the Vagrantfile path, if
|
||||||
|
# there is one.
|
||||||
|
if box_download_ca_cert
|
||||||
|
box_download_ca_cert = File.expand_path(
|
||||||
|
box_download_ca_cert, env[:machine].env.root_path)
|
||||||
|
end
|
||||||
|
|
||||||
lock.synchronize do
|
lock.synchronize do
|
||||||
# Check that we don't already have the box, which can happen
|
# Check that we don't already have the box, which can happen
|
||||||
|
|
|
@ -375,6 +375,16 @@ module VagrantPlugins
|
||||||
errors << I18n.t("vagrant.config.vm.hostname_invalid_characters") if \
|
errors << I18n.t("vagrant.config.vm.hostname_invalid_characters") if \
|
||||||
@hostname && @hostname !~ /^[a-z0-9][-.a-z0-9]+$/i
|
@hostname && @hostname !~ /^[a-z0-9][-.a-z0-9]+$/i
|
||||||
|
|
||||||
|
if box_download_ca_cert
|
||||||
|
path = Pathname.new(box_download_ca_cert).
|
||||||
|
expand_path(machine.env.root_path)
|
||||||
|
if !path.file?
|
||||||
|
errors << I18n.t(
|
||||||
|
"vagrant.config.vm.box_download_ca_cert_not_found",
|
||||||
|
path: box_download_ca_cert)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
has_nfs = false
|
has_nfs = false
|
||||||
used_guest_paths = Set.new
|
used_guest_paths = Set.new
|
||||||
@__synced_folders.each do |id, options|
|
@__synced_folders.each do |id, options|
|
||||||
|
|
|
@ -720,6 +720,8 @@ en:
|
||||||
private_key_missing: "`private_key_path` file must exist: %{path}"
|
private_key_missing: "`private_key_path` file must exist: %{path}"
|
||||||
vm:
|
vm:
|
||||||
base_mac_invalid: "Base MAC address for eth0/NAT must be set. Contact box maintainer for more information."
|
base_mac_invalid: "Base MAC address for eth0/NAT must be set. Contact box maintainer for more information."
|
||||||
|
box_download_ca_cert_not_found: |-
|
||||||
|
"box_download_ca_cert" file not found: %{path}
|
||||||
box_missing: "A box must be specified."
|
box_missing: "A box must be specified."
|
||||||
box_not_found: "The box '%{name}' could not be found."
|
box_not_found: "The box '%{name}' could not be found."
|
||||||
hostname_invalid_characters: |-
|
hostname_invalid_characters: |-
|
||||||
|
|
Loading…
Reference in New Issue