providers/docker: validate create args is list [GH-4850]

This commit is contained in:
Mitchell Hashimoto 2015-07-08 10:25:32 -06:00
parent 855aa66ad9
commit 606a8fdde2
3 changed files with 18 additions and 0 deletions

View File

@ -231,6 +231,10 @@ module VagrantPlugins
end
end
if !@create_args.is_a?(Array)
errors << I18n.t("docker_provider.errors.config.create_args_array")
end
@links.each do |link|
parts = link.split(":")
if parts.length != 2 || parts[0] == "" || parts[1] == ""

View File

@ -123,6 +123,8 @@ en:
"build_dir" must exist and contain a Dockerfile
build_dir_or_image: |-
One of "build_dir" or "image" must be set
create_args_array: |-
"create_args" must be an array
invalid_link: |-
Invalid link (should be 'name:alias'): "%{link}"
invalid_vagrantfile: |-

View File

@ -90,6 +90,18 @@ describe VagrantPlugins::DockerProvider::Config do
end
end
describe "#create_args" do
before do
valid_defaults
end
it "is invalid if it isn't an array" do
subject.create_args = "foo"
subject.finalize!
assert_invalid
end
end
describe "#expose" do
before do
valid_defaults