Module: AssMaintainer::InfoBase::ServerIb::EnterpriseServers::Support::ServerConnection Private

Included in:
Cluster, AssMaintainer::InfoBase::ServerIb::EnterpriseServers::ServerAgent
Defined in:
lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Abstract server connection. Mixin for Cluster and AssMaintainer::InfoBase::ServerIb::EnterpriseServers::ServerAgent

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Host name



139
140
141
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 139

def host
  @host
end

#passwordString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Server user password See #initialize password argument.

Returns:

  • (String)


136
137
138
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 136

def password
  @password
end

#portObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TCP port



142
143
144
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 142

def port
  @port
end

#userString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Server user name See #initialize user argument.

Returns:

  • (String)


131
132
133
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 131

def user
  @user
end

Instance Method Details

#default_portObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



176
177
178
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 176

def default_port
  fail 'Abstract method'
end

#eql?(other) ⇒ Boolean Also known as: ==

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


191
192
193
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 191

def eql?(other)
  host.upcase == other.host.upcase && port == other.port
end

#host_portString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

String like a host_name:port_number.

Returns:

  • (String)


158
159
160
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 158

def host_port
  "#{host}:#{port}"
end

#initialize(host_port, user = nil, password = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • host_port (String)

    string like a host_name:port_number

  • user (String) (defaults to: nil)

    server user name

  • password (String) (defaults to: nil)

    server user password



147
148
149
150
151
152
153
154
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 147

def initialize(host_port, user = nil, password = nil)
  fail ArgumentError, 'Host name require' if host_port.to_s.empty?
  @raw_host_port = host_port
  @host = parse_host
  @port = parse_port || default_port
  @user = user
  @password = password
end

#ping?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return true if TCP port available on server

Returns:

  • (Boolean)


181
182
183
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 181

def ping?
  tcp_ping.ping?
end

#tcp_pingNet::Ping::TCP

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns instance.

Returns:

  • (Net::Ping::TCP)

    instance



187
188
189
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb', line 187

def tcp_ping
  @tcp_ping ||= Net::Ping::TCP.new(host, port)
end