Class: Flydata::AgentCompatibilityCheck

Inherits:
CompatibilityCheck show all
Defined in:
lib/flydata/compatibility_check.rb

Constant Summary collapse

TCP_PORT =
45326
SSL_PORT =
45327

Instance Method Summary collapse

Methods inherited from CompatibilityCheck

#check, #initialize, #print_errors

Methods included from CommandLoggable

#before_logging, #log_error_stderr, #log_info_stdout, #log_warn_stderr

Constructor Details

This class inherits a constructor from Flydata::CompatibilityCheck

Instance Method Details

#check_outgoing_portsObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/flydata/compatibility_check.rb', line 67

def check_outgoing_ports
  ports = [TCP_PORT]
  ports << SSL_PORT unless ENV['FLYDATA_ENV_KEY'] == 'development'

  url = @dp["servers"].first
  errors = {}
  ports.each do |port|
    begin
      e = TCPSocket.new(url, port)
      e.close
    rescue => e
      errors[port] = e
    end
  end

  unless errors.empty?
    message = "Cannot connect to outside ports. Please check to make sure you have these outgoing ports open."
    errors.each do |port, e|
      message += "  Port #{port}, Error #{e.class.name}: #{e.to_s}"
    end
    raise FlydataCore::AgentCompatibilityError, message
  end
end