providers/docker: fix crash if host VM file can't be foundJ:wq
gs
This commit is contained in:
parent
9dd5640324
commit
1c203405d2
|
@ -88,6 +88,8 @@ BUG FIXES:
|
|||
- plugins/login: allow users to login with a token [GH-5145]
|
||||
- providers/docker: Build image from `/var/lib/docker` for more disk
|
||||
space on some systems. [GH-5302]
|
||||
- providers/docker: Fix crash that could occur in some scenarios when
|
||||
the host VM path changed.
|
||||
- providers/hyperv: allow users to configure memory, cpu count, and vmname [GH-5183]
|
||||
- providers/hyperv: import respects secure boot. [GH-5209]
|
||||
- providers/hyperv: only set EFI secure boot for gen 2 machines [GH-5538]
|
||||
|
|
|
@ -44,6 +44,10 @@ module VagrantPlugins
|
|||
class SyncedFolderNonDocker < DockerError
|
||||
error_key(:synced_folder_non_docker)
|
||||
end
|
||||
|
||||
class VagrantfileNotFound < DockerError
|
||||
error_key(:vagrantfile_not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -89,6 +89,10 @@ module VagrantPlugins
|
|||
vagrantfile_name: vf_file,
|
||||
)
|
||||
|
||||
# If there is no root path, then the Vagrantfile wasn't found
|
||||
# and it is an error...
|
||||
raise Errors::VagrantfileNotFound if !host_env.root_path
|
||||
|
||||
host_env.machine(
|
||||
host_machine_name,
|
||||
host_env.default_provider(
|
||||
|
@ -149,8 +153,14 @@ module VagrantPlugins
|
|||
def state
|
||||
state_id = nil
|
||||
state_id = :not_created if !@machine.id
|
||||
state_id = :host_state_unknown if !state_id && \
|
||||
host_vm? && !host_vm.communicate.ready?
|
||||
|
||||
begin
|
||||
state_id = :host_state_unknown if !state_id && \
|
||||
host_vm? && !host_vm.communicate.ready?
|
||||
rescue Errors::VagrantfileNotFound
|
||||
state_id = :host_state_unknown
|
||||
end
|
||||
|
||||
state_id = :not_created if !state_id && \
|
||||
(!@machine.id || !driver.created?(@machine.id))
|
||||
state_id = driver.state(@machine.id) if @machine.id && !state_id
|
||||
|
|
|
@ -196,3 +196,7 @@ en:
|
|||
The "docker" synced folder type can't be used because the provider
|
||||
in use is not Docker. This synced folder type only works with the
|
||||
Docker provider. The provider this machine is using is: %{provider}
|
||||
vagrantfile_not_found: |-
|
||||
The configured host VM Vagrantfile could not be found. Please fix
|
||||
the Vagrantfile for this Docker environment to point to a valid
|
||||
host VM.
|
||||
|
|
Loading…
Reference in New Issue