remotus 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11e887a11735554ddeb7ebc280bb8c76881d3c00fa174964ecf2c3360c70028d
4
- data.tar.gz: 92c02029466a391a243b78de329413bdbccf1f591a89bc0bcbb060a7ad51d5ca
3
+ metadata.gz: 46a1f303af4c352742c56801aee8d5ab8ec801361bf26761d49f8726b6e57f9a
4
+ data.tar.gz: 189b4526eb5c2b76834616d9a399cc601366f4bda6ceffe0d1b8387678d2acd7
5
5
  SHA512:
6
- metadata.gz: 0c1967843958647f1c782bbda27d5b03519febf34faa841a7fe92f190a0ed29d733b50d4fe0b304fea624c8a1de7f3140f34fd5bb9068cc8d9c2fa8401bda0b6
7
- data.tar.gz: cfd15ef457c8aaa9188588fcbd53d55fd62378f4e224d33df57b4a818ad69b839789be32e3ee893588f278e2be6885d23572d32065df707b4f5a6735ad120c04
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.0] - 2021-03-09
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
- - Initial release
10
+ ## [0.1.0] - 2021-03-09
11
+ * Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- remotus (0.2.0)
4
+ remotus (0.2.1)
5
5
  connection_pool (~> 2.2)
6
6
  net-scp (~> 3.0)
7
7
  net-ssh (~> 6.1)
@@ -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
- next unless pool[host].respond_to?(k.to_sym)
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
  #
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Remotus
4
4
  # Remotus gem version
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.1"
6
6
  end
@@ -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.0
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-13 00:00:00.000000000 Z
11
+ date: 2021-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool