provisioners/docker: simplify run, output which are running

This commit is contained in:
Mitchell Hashimoto 2013-12-03 14:33:13 -08:00
parent c55f7dfd64
commit 33d3c28086
3 changed files with 10 additions and 15 deletions

View File

@ -20,22 +20,12 @@ module VagrantPlugins
@images += images.map(&:to_s)
end
def run(*args)
container_name = args.shift
params = {}
if args.empty?
params[:image] = container_name
elsif args.first.is_a?(String)
params[:image] = args.shift
params[:cmd] = container_name
else
params = args.shift
params[:cmd] ||= container_name
end
def run(name, **options)
params = options.dup
params[:image] = name
# TODO: Validate provided parameters before assignment
@containers[container_name.to_s] = params
@containers[name.to_s] = params
end
def finalize!

View File

@ -30,8 +30,11 @@ module VagrantPlugins
cids_dir = "/var/lib/vagrant/cids"
config[:cidfile] ||= "#{cids_dir}/#{Digest::SHA1.hexdigest name}"
@machine.ui.info(I18n.t("vagrant.docker_running", name: name))
@machine.communicate.sudo("mkdir -p #{cids_dir}")
run_container({name: name}.merge config)
run_container({
name: name
}.merge(config))
end
end

View File

@ -47,6 +47,8 @@ en:
Installing Docker onto machine...
docker_pulling_images:
Pulling Docker images...
docker_running: |-
-- Container: %{name}
docker_starting_containers:
Starting Docker containers...
docker_auto_start_not_available: |-