Raise proper class if invalid options given for docker network

This commit is contained in:
Brian Cain 2019-03-04 13:17:14 -08:00
parent 0b28580105
commit a1b48ed1bb
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
3 changed files with 8 additions and 2 deletions

View File

@ -64,8 +64,7 @@ module VagrantPlugins
elsif options[:type] == "dhcp" elsif options[:type] == "dhcp"
network_name = "vagrant_network" network_name = "vagrant_network"
else else
# TODO: Make this an error class raise Errors::NetworkInvalidOption, container: machine.name
raise "Must specify a `subnet` or use `dhcp`"
end end
container_id = machine.id container_id = machine.id

View File

@ -45,6 +45,10 @@ module VagrantPlugins
error_key(:docker_provider_nfs_without_privileged) error_key(:docker_provider_nfs_without_privileged)
end end
class NetworkInvalidOption < DockerError
error_key(:network_invalid_option)
end
class PackageNotSupported < DockerError class PackageNotSupported < DockerError
error_key(:package_not_supported) error_key(:package_not_supported)
end end

View File

@ -197,6 +197,9 @@ en:
is functional and properly configured. is functional and properly configured.
Host VM ID: %{id} Host VM ID: %{id}
network_invalid_option: |-
Invalid option given for docker network for guest "%{container}". Must specify either
a `subnet` or use `type: "dhcp"`.
package_not_supported: |- package_not_supported: |-
The "package" command is not supported with the Docker provider. The "package" command is not supported with the Docker provider.
If you'd like to commit or push your Docker container, please SSH If you'd like to commit or push your Docker container, please SSH