onlyoffice_digitalocean_wrapper 0.7.0 → 0.8.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b5f288d8ace3eb4b4233a65a15ad7205c993361a5218939ecae254902e57d39
|
4
|
+
data.tar.gz: 987062f1ec25e58d45c5c0fadfdd672ac7f4a9908a4b0563be2e000051dca0d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8780c445ee63541b12093435e816a555c05e6d9afeac0244cbb95d88b73b8d5a41b3c4567645ffee12340cfad00ddd1f8a7b2c0c85bfecb7500a292080c0e5e8
|
7
|
+
data.tar.gz: a73c0ce3bfde1c16ad9b96b90ec2cf6a5f4b53dc573ff228930d8f680309a0801c008cb26e473eb4cad194730757a5055ec93a3043137070813b8ec3bd671bdf
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'net-telnet'
|
4
|
+
|
5
|
+
require_relative 'ssh_checker/ssh_checker_exceptions'
|
6
|
+
|
7
|
+
module OnlyofficeDigitaloceanWrapper
|
8
|
+
# Class for check if ssh can be connected
|
9
|
+
class SshChecker
|
10
|
+
include LoggerWrapper
|
11
|
+
# @return [String] ip of server
|
12
|
+
attr_reader :ip
|
13
|
+
|
14
|
+
# @param ip [String] ip of server to check
|
15
|
+
def initialize(ip)
|
16
|
+
@ip = ip
|
17
|
+
end
|
18
|
+
|
19
|
+
# Wait until ssh server on server is up and available for connection
|
20
|
+
# @param timeout [Integer] how much we should wait for connection
|
21
|
+
# @return [void]
|
22
|
+
def wait_until_ssh_up(timeout: 60)
|
23
|
+
wait_between_tries = 5
|
24
|
+
tries = timeout / wait_between_tries
|
25
|
+
tries.times do |try|
|
26
|
+
if ssh_up?
|
27
|
+
logger.info("SSH on `#{@ip}` is up. Waiting finished")
|
28
|
+
return true
|
29
|
+
end
|
30
|
+
|
31
|
+
logger.info("SSH on `#{@ip}` is not up. Waited for #{try * wait_between_tries} seconds of #{timeout}")
|
32
|
+
sleep wait_between_tries
|
33
|
+
end
|
34
|
+
raise SshCheckerSshUpTimeout, "SSH on `#{@ip}` is not up for #{timeout} seconds. Could not proceed"
|
35
|
+
end
|
36
|
+
|
37
|
+
# Check is ssh available for connection right now
|
38
|
+
# @return [Boolean]
|
39
|
+
def ssh_up?
|
40
|
+
Net::Telnet.new('Host' => @ip,
|
41
|
+
'Timeout' => 1,
|
42
|
+
'Port' => 22)
|
43
|
+
true
|
44
|
+
rescue StandardError
|
45
|
+
false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onlyoffice_digitalocean_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ONLYOFFICE
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-09-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: droplet_kit
|
@@ -26,6 +26,20 @@ dependencies:
|
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '3'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: net-telnet
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
29
43
|
- !ruby/object:Gem::Dependency
|
30
44
|
name: codecov
|
31
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,6 +182,8 @@ files:
|
|
168
182
|
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/logger_wrapper.rb
|
169
183
|
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/power_actions.rb
|
170
184
|
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/token_methods.rb
|
185
|
+
- lib/onlyoffice_digitalocean_wrapper/ssh_checker.rb
|
186
|
+
- lib/onlyoffice_digitalocean_wrapper/ssh_checker/ssh_checker_exceptions.rb
|
171
187
|
- lib/onlyoffice_digitalocean_wrapper/version.rb
|
172
188
|
homepage: https://github.com/ONLYOFFICE-QA/onlyoffice_digitalocean_wrapper
|
173
189
|
licenses:
|
@@ -193,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
209
|
- !ruby/object:Gem::Version
|
194
210
|
version: '0'
|
195
211
|
requirements: []
|
196
|
-
rubygems_version: 3.2.
|
212
|
+
rubygems_version: 3.2.27
|
197
213
|
signing_key:
|
198
214
|
specification_version: 4
|
199
215
|
summary: Wrapper gem for DigitalOcean
|