From f660c19084729dd1f42fbb5821fcb00c62d2e507 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Tue, 22 Aug 2017 11:36:26 -0700 Subject: [PATCH] Error when compose and force_host_vm are enabled together --- plugins/providers/docker/config.rb | 4 ++++ templates/locales/providers_docker.yml | 2 ++ .../plugins/providers/docker/config_test.rb | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/plugins/providers/docker/config.rb b/plugins/providers/docker/config.rb index 64d1ae620..b3b6993c6 100644 --- a/plugins/providers/docker/config.rb +++ b/plugins/providers/docker/config.rb @@ -281,6 +281,10 @@ module VagrantPlugins errors << I18n.t("docker_provider.errors.config.compose_configuration_hash") end + if @compose && @force_host_vm + errors << I18n.t("docker_provider.errors.config.compose_force_vm") + end + if !@create_args.is_a?(Array) errors << I18n.t("docker_provider.errors.config.create_args_array") end diff --git a/templates/locales/providers_docker.yml b/templates/locales/providers_docker.yml index e21b90d81..e3c8fd0e2 100644 --- a/templates/locales/providers_docker.yml +++ b/templates/locales/providers_docker.yml @@ -145,6 +145,8 @@ en: One of "build_dir" or "image" must be set compose_configuration_hash: |- "compose_configuration" must be a hash + compose_force_vm: |- + Docker compose is not currently supported from within proxy VM. create_args_array: |- "create_args" must be an array invalid_link: |- diff --git a/test/unit/plugins/providers/docker/config_test.rb b/test/unit/plugins/providers/docker/config_test.rb index eb3c5729a..063634872 100644 --- a/test/unit/plugins/providers/docker/config_test.rb +++ b/test/unit/plugins/providers/docker/config_test.rb @@ -89,6 +89,25 @@ describe VagrantPlugins::DockerProvider::Config do end end + describe "#compose" do + before do + valid_defaults + end + + it "should be valid when enabled" do + subject.compose = true + subject.finalize! + assert_valid + end + + it "should be invalid when force_host_vm is enabled" do + subject.compose = true + subject.force_host_vm = true + subject.finalize! + assert_invalid + end + end + describe "#create_args" do before do valid_defaults