Mitchell Hashimoto 8c7ab333a0 Squash the f-docker-hostmachine branch.
Initial work

commands/up: make sure all names to with_target_vms are strings

providers/docker: create a docker host VM if needed

providers/docker: executor abstraction for driver to eventually support remote

providers/docker: vagrant executor

providers/docker: support creating the machine

providers/docker: status works if host VM is gone

providers/docker: use start fence to get real docker output

core: Call preserves stack ordering

core: support Message post option

providers/docker: Guard some features with HasSSH checks

providers/docker: much better messaging around create/destroy

providers/docker: output the container ID on create

providers/docker: copy the hostmachine Vagrantfile to the data dir

providers/docker: should make host machine before any up action

providers/docker: HandleBox before the host machine

providers/virtualbox: functional_vboxsf to disable vboxsf

providers/virtualbox: synced folder usable method should take 2 args

providers/docker: default machine name to :default
2014-04-21 13:54:33 -07:00

72 lines
2.4 KiB
Ruby

module VagrantPlugins
module DockerProvider
class Config < Vagrant.plugin("2", :config)
attr_accessor :image, :cmd, :ports, :volumes, :privileged
# Additional arguments to pass to `docker run` when creating
# the container for the first time. This is an array of args.
#
# @return [Array<String>]
attr_accessor :create_args
# True if the Docker container exposes SSH access. If this is true,
# then Vagrant can do a bunch more things like setting the hostname,
# provisioning, etc.
attr_accessor :has_ssh
# The name of the machine in the Vagrantfile set with
# "vagrant_vagrantfile" that will be the docker host. Defaults
# to "default"
#
# See the "vagrant_vagrantfile" docs for more info.
#
# @return [String]
attr_accessor :vagrant_machine
# The path to the Vagrantfile that contains a VM that will be
# started as the Docker host if needed (Windows, OS X, Linux
# without container support).
#
# Defaults to a built-in Vagrantfile that will load boot2docker.
#
# NOTE: This only has an effect if Vagrant needs a Docker host.
# Vagrant determines this automatically based on the environment
# it is running in.
#
# @return [String]
attr_accessor :vagrant_vagrantfile
def initialize
@cmd = UNSET_VALUE
@create_args = []
@has_ssh = UNSET_VALUE
@image = UNSET_VALUE
@ports = []
@privileged = UNSET_VALUE
@volumes = []
@vagrant_machine = UNSET_VALUE
@vagrant_vagrantfile = UNSET_VALUE
end
def finalize!
@cmd = [] if @cmd == UNSET_VALUE
@create_args = [] if @create_args == UNSET_VALUE
@has_ssh = false if @has_ssh == UNSET_VALUE
@image = nil if @image == UNSET_VALUE
@privileged = false if @privileged == UNSET_VALUE
@vagrant_machine = nil if @vagrant_machine == UNSET_VALUE
@vagrant_vagrantfile = nil if @vagrant_vagrantfile == UNSET_VALUE
end
def validate(machine)
errors = _detected_errors
# 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
{ "docker provider" => errors }
end
end
end
end