remotus 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -2
- data/Gemfile.lock +1 -1
- data/lib/remotus/host_pool.rb +1 -1
- data/lib/remotus/pool.rb +5 -1
- data/lib/remotus/ssh_connection.rb +12 -1
- data/lib/remotus/version.rb +1 -1
- data/lib/remotus/winrm_connection.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46a1f303af4c352742c56801aee8d5ab8ec801361bf26761d49f8726b6e57f9a
|
4
|
+
data.tar.gz: 189b4526eb5c2b76834616d9a399cc601366f4bda6ceffe0d1b8387678d2acd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 475123658ca6e1aff45ddbefc328405dbaf2a163c5d0d5e28f3e4aba66ea0b4685665311f5218d797cda917a35648509b4dd6e17c760212c7722d6a45e00ebb6
|
7
|
+
data.tar.gz: a27f990ea488f4fb6e163dae3478855c2ef9298626936792eda57b0f9eb2f0ed3fc60602d779f9a2fc977a8bece2e8894718116d5b308bdad947f331c686cc7c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.1
|
3
|
+
## [0.2.1] - 2021-03-15
|
4
|
+
* Fix connection pooling metadata sharing
|
5
|
+
* Fix caching of pooled metadata
|
6
|
+
|
7
|
+
## [0.2.0] - 2021-03-14
|
8
|
+
* Add per-connection metadata support
|
4
9
|
|
5
|
-
-
|
10
|
+
## [0.1.0] - 2021-03-09
|
11
|
+
* Initial release
|
data/Gemfile.lock
CHANGED
data/lib/remotus/host_pool.rb
CHANGED
@@ -57,7 +57,7 @@ module Remotus
|
|
57
57
|
connection_class = Object.const_get("Remotus::#{@proto.capitalize}Connection")
|
58
58
|
port ||= connection_class::REMOTE_PORT
|
59
59
|
|
60
|
-
@pool = ConnectionPool.new(size: size, timeout: timeout) { connection_class.new(host, port) }
|
60
|
+
@pool = ConnectionPool.new(size: size, timeout: timeout) { connection_class.new(host, port, host_pool: self) }
|
61
61
|
@size = size.to_i
|
62
62
|
@timeout = timeout.to_i
|
63
63
|
@expiration_time = Time.now + timeout
|
data/lib/remotus/pool.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "remotus"
|
4
4
|
require "remotus/host_pool"
|
5
|
+
require "remotus/core_ext/string"
|
5
6
|
|
6
7
|
module Remotus
|
7
8
|
# Class representing a connection pool containing many host-specific pools
|
@@ -144,9 +145,12 @@ module Remotus
|
|
144
145
|
return false unless pool[host]
|
145
146
|
|
146
147
|
options.each do |k, v|
|
148
|
+
k = k.to_s.to_method_name
|
149
|
+
|
147
150
|
Remotus.logger.debug { "Checking if option #{k} => #{v} has changed" }
|
148
151
|
|
149
|
-
|
152
|
+
# If any of the options passed are new, assume a change has occurred
|
153
|
+
return true unless pool[host].respond_to?(k.to_sym)
|
150
154
|
|
151
155
|
host_value = pool[host].send(k.to_sym)
|
152
156
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "forwardable"
|
3
4
|
require "remotus"
|
4
5
|
require "remotus/result"
|
5
6
|
require "remotus/auth"
|
@@ -9,6 +10,8 @@ require "net/ssh"
|
|
9
10
|
module Remotus
|
10
11
|
# Class representing an SSH connection to a host
|
11
12
|
class SshConnection
|
13
|
+
extend Forwardable
|
14
|
+
|
12
15
|
# Standard SSH remote port
|
13
16
|
REMOTE_PORT = 22
|
14
17
|
|
@@ -24,16 +27,24 @@ module Remotus
|
|
24
27
|
# @return [String] host hostname
|
25
28
|
attr_reader :host
|
26
29
|
|
30
|
+
# @return [Remotus::HostPool] host_pool associated host pool
|
31
|
+
attr_reader :host_pool
|
32
|
+
|
33
|
+
# Delegate metadata methods to associated host pool
|
34
|
+
def_delegators :@host_pool, :[], :[]=
|
35
|
+
|
27
36
|
#
|
28
37
|
# Creates an SshConnection
|
29
38
|
#
|
30
39
|
# @param [String] host hostname
|
31
40
|
# @param [Integer] port remote port
|
41
|
+
# @param [Remotus::HostPool] host_pool associated host pool
|
32
42
|
#
|
33
|
-
def initialize(host, port = REMOTE_PORT)
|
43
|
+
def initialize(host, port = REMOTE_PORT, host_pool: nil)
|
34
44
|
Remotus.logger.debug { "Creating SshConnection #{object_id} for #{host}" }
|
35
45
|
@host = host
|
36
46
|
@port = port
|
47
|
+
@host_pool = host_pool
|
37
48
|
end
|
38
49
|
|
39
50
|
#
|
data/lib/remotus/version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "forwardable"
|
3
4
|
require "remotus"
|
4
5
|
require "remotus/result"
|
5
6
|
require "remotus/auth"
|
@@ -9,6 +10,8 @@ require "winrm-fs"
|
|
9
10
|
module Remotus
|
10
11
|
# Class representing a WinRM connection to a host
|
11
12
|
class WinrmConnection
|
13
|
+
extend Forwardable
|
14
|
+
|
12
15
|
# Standard WinRM remote port
|
13
16
|
REMOTE_PORT = 5985
|
14
17
|
|
@@ -18,15 +21,23 @@ module Remotus
|
|
18
21
|
# @return [String] host hostname
|
19
22
|
attr_reader :host
|
20
23
|
|
24
|
+
# @return [Remotus::HostPool] host_pool associated host pool
|
25
|
+
attr_reader :host_pool
|
26
|
+
|
27
|
+
# Delegate metadata methods to associated host pool
|
28
|
+
def_delegators :@host_pool, :[], :[]=
|
29
|
+
|
21
30
|
#
|
22
31
|
# Creates a WinrmConnection
|
23
32
|
#
|
24
33
|
# @param [String] host hostname
|
25
34
|
# @param [Integer] port remote port
|
35
|
+
# @param [Remotus::HostPool] host_pool associated host pool
|
26
36
|
#
|
27
|
-
def initialize(host, port = REMOTE_PORT)
|
37
|
+
def initialize(host, port = REMOTE_PORT, host_pool: nil)
|
28
38
|
@host = host
|
29
39
|
@port = port
|
40
|
+
@host_pool = host_pool
|
30
41
|
end
|
31
42
|
|
32
43
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remotus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Newell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|