Class: Indocker::ServerPools::ServerConnection
- Inherits:
-
Object
- Object
- Indocker::ServerPools::ServerConnection
show all
- Defined in:
- lib/indocker/server_pools/server_connection.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(logger:, configuration:, server:) ⇒ ServerConnection
Returns a new instance of ServerConnection.
4
5
6
7
8
|
# File 'lib/indocker/server_pools/server_connection.rb', line 4
def initialize(logger:, configuration:, server:)
@logger = logger
@configuration = configuration
@server = server
end
|
Instance Attribute Details
#server ⇒ Object
Returns the value of attribute server.
2
3
4
|
# File 'lib/indocker/server_pools/server_connection.rb', line 2
def server
@server
end
|
#session ⇒ Object
Returns the value of attribute session.
2
3
4
|
# File 'lib/indocker/server_pools/server_connection.rb', line 2
def session
@session
end
|
Instance Method Details
#busy? ⇒ Boolean
33
34
35
|
# File 'lib/indocker/server_pools/server_connection.rb', line 33
def busy?
!!@busy
end
|
#close_session ⇒ Object
25
26
27
|
# File 'lib/indocker/server_pools/server_connection.rb', line 25
def close_session
@session.close if @session
end
|
#create_session! ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/indocker/server_pools/server_connection.rb', line 10
def create_session!
return unless @server
@session = Indocker::SshSession.new(
host: @server.host,
user: @server.user,
port: @server.port,
logger: @logger
)
end
|
#exec!(command) ⇒ Object
21
22
23
|
# File 'lib/indocker/server_pools/server_connection.rb', line 21
def exec!(command)
@session.exec!(command)
end
|
#set_busy(flag) ⇒ Object
29
30
31
|
# File 'lib/indocker/server_pools/server_connection.rb', line 29
def set_busy(flag)
@busy = !!flag
end
|