provisioners/docker: simplify run, output which are running
This commit is contained in:
parent
c55f7dfd64
commit
33d3c28086
|
@ -20,22 +20,12 @@ module VagrantPlugins
|
||||||
@images += images.map(&:to_s)
|
@images += images.map(&:to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(*args)
|
def run(name, **options)
|
||||||
container_name = args.shift
|
params = options.dup
|
||||||
params = {}
|
params[:image] = name
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
# TODO: Validate provided parameters before assignment
|
# TODO: Validate provided parameters before assignment
|
||||||
@containers[container_name.to_s] = params
|
@containers[name.to_s] = params
|
||||||
end
|
end
|
||||||
|
|
||||||
def finalize!
|
def finalize!
|
||||||
|
|
|
@ -30,8 +30,11 @@ module VagrantPlugins
|
||||||
cids_dir = "/var/lib/vagrant/cids"
|
cids_dir = "/var/lib/vagrant/cids"
|
||||||
config[:cidfile] ||= "#{cids_dir}/#{Digest::SHA1.hexdigest name}"
|
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}")
|
@machine.communicate.sudo("mkdir -p #{cids_dir}")
|
||||||
run_container({name: name}.merge config)
|
run_container({
|
||||||
|
name: name
|
||||||
|
}.merge(config))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ en:
|
||||||
Installing Docker onto machine...
|
Installing Docker onto machine...
|
||||||
docker_pulling_images:
|
docker_pulling_images:
|
||||||
Pulling Docker images...
|
Pulling Docker images...
|
||||||
|
docker_running: |-
|
||||||
|
-- Container: %{name}
|
||||||
docker_starting_containers:
|
docker_starting_containers:
|
||||||
Starting Docker containers...
|
Starting Docker containers...
|
||||||
docker_auto_start_not_available: |-
|
docker_auto_start_not_available: |-
|
||||||
|
|
Loading…
Reference in New Issue