From 08e9352c54a378ee3427fb33f4ffa1afdd958107 Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Wed, 8 Feb 2023 22:45:45 -0600 Subject: [PATCH] DOCKER_HOST env support --- tasks/docker.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasks/docker.rb b/tasks/docker.rb index ca6f0e35..6bbcd412 100755 --- a/tasks/docker.rb +++ b/tasks/docker.rb @@ -2,6 +2,7 @@ # frozen_string_literal: true require 'json' +require 'uri' require 'yaml' require 'puppet_litmus' require_relative '../lib/task_helper' @@ -152,7 +153,11 @@ def provision(image, inventory_location, vars) os_release_facts = get_image_os_release_facts(image) distro = os_release_facts['ID'] version = os_release_facts['VERSION_ID'] - hostname = 'localhost' + hostname = if ENV.key?('DOCKER_HOST') && !ENV['DOCKER_HOST'].empty? + URI.parse(ENV['DOCKER_HOST']).host || ENV['DOCKER_HOST'] + else + 'localhost' + end group_name = 'ssh_nodes' warn '!!! Using private port forwarding!!!' front_facing_port = random_ssh_forwarding_port