Class: GDK::Diagnostic::Hostname

Inherits:
Base
  • Object
show all
Defined in:
lib/gdk/diagnostic/hostname.rb

Constant Summary collapse

TITLE =
'GDK Hostname'

Instance Method Summary collapse

Methods inherited from Base

#message, #title

Instance Method Details

#detailObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/gdk/diagnostic/hostname.rb', line 14

def detail
  return if success?

  if hostname_ips.empty?
    return <<~MESSAGE
      Could not resolve IP address for the GDK hostname `#{hostname}`
      Is it set up in `/etc/hosts`?
    MESSAGE
  end

  <<~MESSAGE
    The GDK hostname `#{hostname}` resolves to the IP addresses #{hostname_ips.join(', ')}.
    The listen_address defined in your GDK config is `#{listen_address}`.
    You should make sure that the two match.

    Either fix the IP address in `/etc/hosts` to match #{listen_address}, or run:

       #{hostname_ips.map { |ip| "gdk config set listen_address #{ip}" }.join("\n")}
  MESSAGE
end

#success?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/gdk/diagnostic/hostname.rb', line 10

def success?
  hostname_ips.include?(listen_address)
end