providers/docker: Clean up config and make a spec
This commit is contained in:
parent
61ffa53134
commit
2e13feb130
|
@ -4,8 +4,8 @@ module VagrantPlugins
|
||||||
attr_accessor :image, :cmd, :ports, :volumes, :privileged
|
attr_accessor :image, :cmd, :ports, :volumes, :privileged
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@image = nil
|
|
||||||
@cmd = UNSET_VALUE
|
@cmd = UNSET_VALUE
|
||||||
|
@image = UNSET_VALUE
|
||||||
@ports = []
|
@ports = []
|
||||||
@privileged = UNSET_VALUE
|
@privileged = UNSET_VALUE
|
||||||
@volumes = []
|
@volumes = []
|
||||||
|
@ -13,6 +13,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
def finalize!
|
def finalize!
|
||||||
@cmd = [] if @cmd == UNSET_VALUE
|
@cmd = [] if @cmd == UNSET_VALUE
|
||||||
|
@image = nil if @image == UNSET_VALUE
|
||||||
@privileged = false if @privileged == UNSET_VALUE
|
@privileged = false if @privileged == UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,13 +23,7 @@ module VagrantPlugins
|
||||||
# TODO: Detect if base image has a CMD / ENTRYPOINT set before erroring out
|
# TODO: Detect if base image has a CMD / ENTRYPOINT set before erroring out
|
||||||
errors << I18n.t("docker_provider.errors.config.cmd_not_set") if @cmd == UNSET_VALUE
|
errors << I18n.t("docker_provider.errors.config.cmd_not_set") if @cmd == UNSET_VALUE
|
||||||
|
|
||||||
{ "docker-provider" => errors }
|
{ "docker provider" => errors }
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def using_nfs?(machine)
|
|
||||||
machine.config.vm.synced_folders.any? { |_, opts| opts[:type] == :nfs }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
require_relative "../../../base"
|
||||||
|
|
||||||
|
require Vagrant.source_root.join("plugins/providers/docker/config")
|
||||||
|
|
||||||
|
describe VagrantPlugins::DockerProvider::Config do
|
||||||
|
end
|
Loading…
Reference in New Issue