Module: EventStore::HTTP::Connect::Controls::IPAddress::Loopback::Alias::VerifyAll

Defined in:
lib/event_store/http/connect/controls/ip_address/loopback/alias.rb

Class Method Summary collapse

Class Method Details

.callObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/event_store/http/connect/controls/ip_address/loopback/alias.rb', line 21

def self.call
  port = Port::Unused.get

  unaliased_ip_addresses = list.select do |ip_address|
    begin
      server = TCPServer.new ip_address, port
      server.close
      false
    rescue Errno::EADDRNOTAVAIL
      true
    end
  end

  return true if unaliased_ip_addresses.none?

  warn "  The following loopback aliases are not configured:\n\n      \#{unaliased_ip_addresses * \"\\n    \"}\n\n  To setup a loopback alias, run the following command:\n\n      sudo ifconfig lo0 alias 127.0.111.1\n\n  Note that the above command was tested on OS X and may vary\n  on Linux systems.\n  MESSAGE\n\n  false\nend\n"

.listObject



52
53
54
55
56
57
58
# File 'lib/event_store/http/connect/controls/ip_address/loopback/alias.rb', line 52

def self.list
  [
    Alias.example,
    *Cluster::IPAddress.list,
    *Cluster::IPAddress::Unavailable.list
  ]
end