Skip to content

Commit 08e9352

Browse files
committed
DOCKER_HOST env support
1 parent 8e239b3 commit 08e9352

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tasks/docker.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# frozen_string_literal: true
33

44
require 'json'
5+
require 'uri'
56
require 'yaml'
67
require 'puppet_litmus'
78
require_relative '../lib/task_helper'
@@ -152,7 +153,11 @@ def provision(image, inventory_location, vars)
152153
os_release_facts = get_image_os_release_facts(image)
153154
distro = os_release_facts['ID']
154155
version = os_release_facts['VERSION_ID']
155-
hostname = 'localhost'
156+
hostname = if ENV.key?('DOCKER_HOST') && !ENV['DOCKER_HOST'].empty?
157+
URI.parse(ENV['DOCKER_HOST']).host || ENV['DOCKER_HOST']
158+
else
159+
'localhost'
160+
end
156161
group_name = 'ssh_nodes'
157162
warn '!!! Using private port forwarding!!!'
158163
front_facing_port = random_ssh_forwarding_port

0 commit comments

Comments
 (0)