diff --git a/plugins/providers/docker/action/network.rb b/plugins/providers/docker/action/network.rb index 0627a156f..ece840310 100644 --- a/plugins/providers/docker/action/network.rb +++ b/plugins/providers/docker/action/network.rb @@ -64,8 +64,7 @@ module VagrantPlugins elsif options[:type] == "dhcp" network_name = "vagrant_network" else - # TODO: Make this an error class - raise "Must specify a `subnet` or use `dhcp`" + raise Errors::NetworkInvalidOption, container: machine.name end container_id = machine.id diff --git a/plugins/providers/docker/errors.rb b/plugins/providers/docker/errors.rb index 36e1b9859..ffd085427 100644 --- a/plugins/providers/docker/errors.rb +++ b/plugins/providers/docker/errors.rb @@ -45,6 +45,10 @@ module VagrantPlugins error_key(:docker_provider_nfs_without_privileged) end + class NetworkInvalidOption < DockerError + error_key(:network_invalid_option) + end + class PackageNotSupported < DockerError error_key(:package_not_supported) end diff --git a/templates/locales/providers_docker.yml b/templates/locales/providers_docker.yml index ba90473c6..d6f805407 100644 --- a/templates/locales/providers_docker.yml +++ b/templates/locales/providers_docker.yml @@ -197,6 +197,9 @@ en: is functional and properly configured. 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: |- The "package" command is not supported with the Docker provider. If you'd like to commit or push your Docker container, please SSH