Skip to content

Commit

Permalink
Merge pull request #1901 from guangyee/want_fqdn
Browse files Browse the repository at this point in the history
allow user to ask for FQDN as public hostname (SOC-9616)
  • Loading branch information
toabctl authored Aug 26, 2019
2 parents 1de18b9 + 4ad0e46 commit 3e1e65b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions chef/cookbooks/utils/libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def self.get_host_for_admin_url(node, use_cluster = false)
end
end

def self.get_host_for_public_url(node, use_ssl, use_cluster = false)
def self.get_host_for_public_url(node, use_ssl, use_cluster = false,
want_fqdn = false)
if use_cluster && defined?(CrowbarPacemakerHelper)
# loose dependency on the pacemaker cookbook
cluster_vhostname = CrowbarPacemakerHelper.cluster_vhostname(node)
Expand All @@ -49,14 +50,15 @@ def self.get_host_for_public_url(node, use_ssl, use_cluster = false)
end

# For the public endpoint, we prefer the public name. If not set, then we
# use the IP address except for SSL, where we always prefer a hostname
# (for certificate validation).
# use hostname when approprate (i.e. for SSL certificate validation or
# WebSSO identification), otherwise we use the IP address.
if public_name.nil? || public_name.empty?
if use_ssl
public_name = public_fqdn
else
public_name = public_ip
end
public_name =
if use_ssl || want_fqdn
public_fqdn
else
public_ip
end
end

public_name
Expand Down

0 comments on commit 3e1e65b

Please sign in to comment.