Skip to content

Commit

Permalink
DOCKER_HOST env support
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tw1r3 committed Feb 9, 2023
1 parent 8e239b3 commit 08e9352
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tasks/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# frozen_string_literal: true

require 'json'
require 'uri'
require 'yaml'
require 'puppet_litmus'
require_relative '../lib/task_helper'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 08e9352

Please sign in to comment.