remotus 1.0.0 → 1.1.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/.gitignore +2 -0
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +8 -5
- data/lib/remotus/ssh_connection.rb +23 -3
- data/lib/remotus/version.rb +1 -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: 66301e654fe9408264dbf7d7313fb93ff7cc3e5b8758cd5584f9d69aef477a4e
         | 
| 4 | 
            +
              data.tar.gz: 5c8793e11d677261f6db58fb415030b23262b0c61559777282ea29413e0203ba
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2567a652c903e2538ceb352b01ec606e983b5aa6f64a64d707ac35302121462cd15373f6463920053831d169f1cb37c0287be206798f81b28afb5e0c30de357a
         | 
| 7 | 
            +
              data.tar.gz: cacd8478695fbac5ea33d76356a5d553af541249615c3ff57b60adf497e99593784a16d8ae5d2fb61803565f49b40d7e6ab0ee7a4c7b019d0502d57cf5406c14
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.rubocop.yml
    CHANGED
    
    | @@ -14,7 +14,7 @@ Layout/LineLength: | |
| 14 14 | 
             
              Max: 150
         | 
| 15 15 |  | 
| 16 16 | 
             
            Metrics/ClassLength:
         | 
| 17 | 
            -
              Max:  | 
| 17 | 
            +
              Max: 300
         | 
| 18 18 |  | 
| 19 19 | 
             
            Metrics/BlockLength:
         | 
| 20 20 | 
             
              Exclude:
         | 
| @@ -46,3 +46,6 @@ Metrics/ParameterLists: | |
| 46 46 |  | 
| 47 47 | 
             
            Gemspec/RequireMFA:
         | 
| 48 48 | 
             
              Enabled: false
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            Gemspec/DevelopmentDependencies:
         | 
| 51 | 
            +
              EnforcedStyle: gemspec
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,10 @@ | |
| 1 | 
            +
            ## [1.1.1] - 2023-05-26
         | 
| 2 | 
            +
            * Handle close failures and improve logging around connection status.
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            ## [1.1.0] - 2023-05-25
         | 
| 5 | 
            +
            * Improve exponential backoff during SSH retries.
         | 
| 6 | 
            +
            * Force connection close on IOError (closed stream).
         | 
| 7 | 
            +
             | 
| 1 8 | 
             
            ## [1.0.0] - 2023-04-25
         | 
| 2 9 | 
             
            * Update SSH dependencies to handle `pkeys are immutable on OpenSSL 3.0` errors on newer Ruby versions
         | 
| 3 10 | 
             
            * Remove Ruby 2.5 support
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                remotus (1. | 
| 4 | 
            +
                remotus (1.1.1)
         | 
| 5 5 | 
             
                  connection_pool (~> 2.4)
         | 
| 6 6 | 
             
                  net-scp (~> 4.0)
         | 
| 7 7 | 
             
                  net-ssh (~> 7.1)
         | 
| @@ -15,7 +15,7 @@ GEM | |
| 15 15 | 
             
              specs:
         | 
| 16 16 | 
             
                ast (2.4.2)
         | 
| 17 17 | 
             
                builder (3.2.4)
         | 
| 18 | 
            -
                connection_pool (2.4. | 
| 18 | 
            +
                connection_pool (2.4.1)
         | 
| 19 19 | 
             
                diff-lcs (1.5.0)
         | 
| 20 20 | 
             
                erubi (1.12.0)
         | 
| 21 21 | 
             
                ffi (1.15.5)
         | 
| @@ -57,7 +57,7 @@ GEM | |
| 57 57 | 
             
                  diff-lcs (>= 1.2.0, < 2.0)
         | 
| 58 58 | 
             
                  rspec-support (~> 3.12.0)
         | 
| 59 59 | 
             
                rspec-support (3.12.0)
         | 
| 60 | 
            -
                rubocop (1. | 
| 60 | 
            +
                rubocop (1.51.0)
         | 
| 61 61 | 
             
                  json (~> 2.3)
         | 
| 62 62 | 
             
                  parallel (~> 1.10)
         | 
| 63 63 | 
             
                  parser (>= 3.2.0.0)
         | 
| @@ -67,15 +67,18 @@ GEM | |
| 67 67 | 
             
                  rubocop-ast (>= 1.28.0, < 2.0)
         | 
| 68 68 | 
             
                  ruby-progressbar (~> 1.7)
         | 
| 69 69 | 
             
                  unicode-display_width (>= 2.4.0, < 3.0)
         | 
| 70 | 
            -
                rubocop-ast (1.28. | 
| 70 | 
            +
                rubocop-ast (1.28.1)
         | 
| 71 71 | 
             
                  parser (>= 3.2.1.0)
         | 
| 72 72 | 
             
                rubocop-capybara (2.18.0)
         | 
| 73 73 | 
             
                  rubocop (~> 1.41)
         | 
| 74 | 
            +
                rubocop-factory_bot (2.23.1)
         | 
| 75 | 
            +
                  rubocop (~> 1.33)
         | 
| 74 76 | 
             
                rubocop-rake (0.6.0)
         | 
| 75 77 | 
             
                  rubocop (~> 1.0)
         | 
| 76 | 
            -
                rubocop-rspec (2. | 
| 78 | 
            +
                rubocop-rspec (2.22.0)
         | 
| 77 79 | 
             
                  rubocop (~> 1.33)
         | 
| 78 80 | 
             
                  rubocop-capybara (~> 2.17)
         | 
| 81 | 
            +
                  rubocop-factory_bot (~> 2.22)
         | 
| 79 82 | 
             
                ruby-progressbar (1.13.0)
         | 
| 80 83 | 
             
                rubyntlm (0.6.3)
         | 
| 81 84 | 
             
                rubyzip (2.3.2)
         | 
| @@ -20,7 +20,7 @@ module Remotus | |
| 20 20 | 
             
                KEEPALIVE_INTERVAL = 300
         | 
| 21 21 |  | 
| 22 22 | 
             
                # Number of default retries
         | 
| 23 | 
            -
                DEFAULT_RETRIES =  | 
| 23 | 
            +
                DEFAULT_RETRIES = 8
         | 
| 24 24 |  | 
| 25 25 | 
             
                # Base options for new SSH connections
         | 
| 26 26 | 
             
                BASE_CONNECT_OPTIONS = { non_interactive: true, keepalive: true, keepalive_interval: KEEPALIVE_INTERVAL }.freeze
         | 
| @@ -154,9 +154,21 @@ module Remotus | |
| 154 154 | 
             
                # Closes the current SSH connection if it is active
         | 
| 155 155 | 
             
                #
         | 
| 156 156 | 
             
                def close
         | 
| 157 | 
            -
                   | 
| 157 | 
            +
                  Remotus.logger.debug { "Closing SSH connection." }
         | 
| 158 158 |  | 
| 159 | 
            -
                   | 
| 159 | 
            +
                  begin
         | 
| 160 | 
            +
                    @connection&.close
         | 
| 161 | 
            +
                  rescue StandardError => e
         | 
| 162 | 
            +
                    Remotus.logger.warn { "Failed to close existing SSH connection with error #{e}" }
         | 
| 163 | 
            +
                  end
         | 
| 164 | 
            +
             | 
| 165 | 
            +
                  begin
         | 
| 166 | 
            +
                    @gateway&.connection&.shutdown! if via_gateway?
         | 
| 167 | 
            +
                  rescue StandardError => e
         | 
| 168 | 
            +
                    Remotus.logger.warn { "Failed to close existing SSH gateway connection with error #{e}" }
         | 
| 169 | 
            +
                  end
         | 
| 170 | 
            +
             | 
| 171 | 
            +
                  Remotus.logger.debug { "Setting @gateway and @connection to nil." }
         | 
| 160 172 |  | 
| 161 173 | 
             
                  @gateway = nil
         | 
| 162 174 | 
             
                  @connection = nil
         | 
| @@ -424,6 +436,8 @@ module Remotus | |
| 424 436 | 
             
                # @param [Integer] retries number of retries
         | 
| 425 437 | 
             
                #
         | 
| 426 438 | 
             
                def with_retries(command, retries)
         | 
| 439 | 
            +
                  sleep_time = 1
         | 
| 440 | 
            +
             | 
| 427 441 | 
             
                  yield if block_given?
         | 
| 428 442 | 
             
                rescue Remotus::AuthenticationError, Net::SSH::AuthenticationFailed => e
         | 
| 429 443 | 
             
                  # Re-raise exception if the retry count is exceeded
         | 
| @@ -446,6 +460,12 @@ module Remotus | |
| 446 460 | 
             
                  retries -= 1
         | 
| 447 461 | 
             
                  raise if e.to_s != "closed stream" || retries.negative?
         | 
| 448 462 |  | 
| 463 | 
            +
                  # Close the existing connection before retrying again
         | 
| 464 | 
            +
                  close
         | 
| 465 | 
            +
             | 
| 466 | 
            +
                  Remotus.logger.debug { "Sleeping for #{sleep_time} seconds before next retry..." }
         | 
| 467 | 
            +
                  sleep sleep_time
         | 
| 468 | 
            +
                  sleep_time *= 2 # Double delay for each retry
         | 
| 449 469 | 
             
                  retry
         | 
| 450 470 | 
             
                end
         | 
| 451 471 |  | 
    
        data/lib/remotus/version.rb
    CHANGED
    
    
    
        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: 1. | 
| 4 | 
            +
              version: 1.1.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: 2023- | 
| 11 | 
            +
            date: 2023-05-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: connection_pool
         |