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
29
30
31
|
# File 'lib/indocker/server_pools/server_connection.rb', line 29
def busy?
!!@busy
end
|
#close_session ⇒ Object
20
21
22
23
|
# File 'lib/indocker/server_pools/server_connection.rb', line 20
def close_session
@session.close if @session
@session = nil
end
|
#create_session! ⇒ Object
10
11
12
13
14
|
# File 'lib/indocker/server_pools/server_connection.rb', line 10
def create_session!
return unless @server
@session = Indocker::SshSession.for(@server, logger: @logger)
end
|
#exec!(command) ⇒ Object
16
17
18
|
# File 'lib/indocker/server_pools/server_connection.rb', line 16
def exec!(command)
@session.exec!(command)
end
|
#set_busy(flag) ⇒ Object
25
26
27
|
# File 'lib/indocker/server_pools/server_connection.rb', line 25
def set_busy(flag)
@busy = !!flag
end
|