onlyoffice_digitalocean_wrapper 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/exceptions_retryer.rb +1 -1
- data/lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/getters.rb +0 -9
- data/lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/ip_getters.rb +25 -0
- data/lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/token_methods.rb +3 -1
- data/lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper.rb +9 -4
- data/lib/onlyoffice_digitalocean_wrapper/version.rb +1 -1
- metadata +6 -130
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36e4b1f04e6c0aebdbfeb107f577a367bf298c8c4004955734110db26b01b7a6
|
4
|
+
data.tar.gz: 375770be15fc82e73619aab137d83ab5e8824a1a6097854064c63e42588471c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eaeba9c86ab045ceb854020ac05f6fb4672e2931b9485ddc5284800afd1d6d7a6e024198032c04be38a17a3d4e4d2bcc4259614f86f15976787c5527c38409d
|
7
|
+
data.tar.gz: 300403c3cb2ac438cc7f8c4a57853034ed28d5eb77a3c2109bd1b0a8aeac45ff03e1d0896098a6d412fe2e11d2c4f64a7757618f4f4b3ed6c839a580ffef8e18
|
@@ -15,7 +15,7 @@ module OnlyofficeDigitaloceanWrapper
|
|
15
15
|
yield
|
16
16
|
rescue exception => e
|
17
17
|
try += 1
|
18
|
-
logger.error("Error '#{exception}, #{e}' happened during "\
|
18
|
+
logger.error("Error '#{exception}, #{e}' happened during " \
|
19
19
|
"operation. Retrying #{try} of #{retries}")
|
20
20
|
sleep timeout # Time to cooldown error
|
21
21
|
try <= retries ? retry : raise
|
@@ -93,14 +93,5 @@ module OnlyofficeDigitaloceanWrapper
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
96
|
-
|
97
|
-
# Get public ip of droplet
|
98
|
-
# @param [DropletKit] droplet to get ip
|
99
|
-
# @return [String] public ip
|
100
|
-
def public_ip(droplet)
|
101
|
-
networks = droplet.networks.to_a.first
|
102
|
-
public_network = networks.find { |net| net.type == 'public' }
|
103
|
-
public_network.ip_address
|
104
|
-
end
|
105
96
|
end
|
106
97
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OnlyofficeDigitaloceanWrapper
|
4
|
+
# Get methods for IP
|
5
|
+
module IpGetters
|
6
|
+
# Get ip of droplet
|
7
|
+
# @param [DropletKit] droplet to get ip
|
8
|
+
# @param [String] network_type to get ip
|
9
|
+
# @return [String, nil] ip of droplet or `nil` if there is no such network
|
10
|
+
def droplet_ip(droplet, network_type = 'public')
|
11
|
+
networks = droplet.networks.to_a.first
|
12
|
+
specific_network = networks.find { |net| net.type == network_type }
|
13
|
+
return nil unless specific_network
|
14
|
+
|
15
|
+
specific_network.ip_address
|
16
|
+
end
|
17
|
+
|
18
|
+
# Get public ip of droplet
|
19
|
+
# @param [DropletKit] droplet to get ip
|
20
|
+
# @return [String, nil] public ip or `nil` if there is no such network
|
21
|
+
def public_ip(droplet)
|
22
|
+
droplet_ip(droplet, 'public')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -20,7 +20,9 @@ module OnlyofficeDigitaloceanWrapper
|
|
20
20
|
# @return [String] token
|
21
21
|
def read_token(token_file_path: "#{Dir.home}/.do/access_token",
|
22
22
|
force_file_read: false)
|
23
|
-
|
23
|
+
# rubocop:disable Style/FetchEnvVar
|
24
|
+
return ENV['DO_ACCESS_TOKEN'] if ENV.key?('DO_ACCESS_TOKEN') && !force_file_read
|
25
|
+
# rubocop:enable Style/FetchEnvVar
|
24
26
|
|
25
27
|
File.read(token_file_path).delete("\n")
|
26
28
|
rescue Errno::ENOENT
|
@@ -4,6 +4,7 @@ require 'droplet_kit'
|
|
4
4
|
require_relative 'digitalocean_wrapper/digitalocean_exceptions'
|
5
5
|
require_relative 'digitalocean_wrapper/exceptions_retryer'
|
6
6
|
require_relative 'digitalocean_wrapper/getters'
|
7
|
+
require_relative 'digitalocean_wrapper/ip_getters'
|
7
8
|
require_relative 'digitalocean_wrapper/logger_wrapper'
|
8
9
|
require_relative 'digitalocean_wrapper/power_actions'
|
9
10
|
require_relative 'digitalocean_wrapper/token_methods'
|
@@ -13,6 +14,7 @@ module OnlyofficeDigitaloceanWrapper
|
|
13
14
|
# Class for wrapping DigitalOcean API gem
|
14
15
|
class DigitalOceanWrapper
|
15
16
|
include Getters
|
17
|
+
include IpGetters
|
16
18
|
include LoggerWrapper
|
17
19
|
include ExceptionsRetryer
|
18
20
|
include PowerActions
|
@@ -31,15 +33,18 @@ module OnlyofficeDigitaloceanWrapper
|
|
31
33
|
# Wait until droplet has status
|
32
34
|
# @param droplet_name [String] name of droplet
|
33
35
|
# @param status [String] status to wait
|
34
|
-
# @param params [Hash]
|
36
|
+
# @param params [Hash] additional params
|
37
|
+
# @option params [Integer] :timeout (300) maximum time to wait in seconds
|
38
|
+
# @option params [Integer] :interval (10) interval time between status checks in seconds
|
35
39
|
# @return [Symbol] droplet status after wait over
|
36
40
|
def wait_until_droplet_have_status(droplet_name, status = 'active', params = {})
|
37
41
|
timeout = params.fetch(:timeout, 300)
|
42
|
+
interval = params.fetch(:interval, 10)
|
38
43
|
counter = 0
|
39
44
|
while get_droplet_status_by_name(droplet_name) != status && counter < timeout
|
40
|
-
counter +=
|
41
|
-
sleep
|
42
|
-
logger.info("waiting for droplet (#{droplet_name}) to have "\
|
45
|
+
counter += interval
|
46
|
+
sleep(interval)
|
47
|
+
logger.info("waiting for droplet (#{droplet_name}) to have " \
|
43
48
|
"status: #{status} for #{counter} seconds of #{timeout}")
|
44
49
|
end
|
45
50
|
raise DropletOperationTimeout, "#{droplet_name} was not #{status} for #{timeout}s" if counter >= timeout
|
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.9.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:
|
13
|
+
date: 2024-07-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: droplet_kit
|
@@ -40,132 +40,6 @@ dependencies:
|
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: codecov
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '0'
|
50
|
-
type: :development
|
51
|
-
prerelease: false
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - "~>"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '0'
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: overcommit
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - "~>"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '0'
|
64
|
-
type: :development
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - "~>"
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: rake
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - "~>"
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '13.0'
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - "~>"
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '13.0'
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: rspec
|
87
|
-
requirement: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - "~>"
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '3'
|
92
|
-
type: :development
|
93
|
-
prerelease: false
|
94
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
requirements:
|
96
|
-
- - "~>"
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: '3'
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: rubocop
|
101
|
-
requirement: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: 0.49.0
|
106
|
-
type: :development
|
107
|
-
prerelease: false
|
108
|
-
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
requirements:
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: 0.49.0
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: rubocop-performance
|
115
|
-
requirement: !ruby/object:Gem::Requirement
|
116
|
-
requirements:
|
117
|
-
- - "~>"
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '1'
|
120
|
-
type: :development
|
121
|
-
prerelease: false
|
122
|
-
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
requirements:
|
124
|
-
- - "~>"
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: '1'
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: rubocop-rake
|
129
|
-
requirement: !ruby/object:Gem::Requirement
|
130
|
-
requirements:
|
131
|
-
- - "~>"
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
requirements:
|
138
|
-
- - "~>"
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: '0'
|
141
|
-
- !ruby/object:Gem::Dependency
|
142
|
-
name: rubocop-rspec
|
143
|
-
requirement: !ruby/object:Gem::Requirement
|
144
|
-
requirements:
|
145
|
-
- - "~>"
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
version: '2'
|
148
|
-
type: :development
|
149
|
-
prerelease: false
|
150
|
-
version_requirements: !ruby/object:Gem::Requirement
|
151
|
-
requirements:
|
152
|
-
- - "~>"
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
version: '2'
|
155
|
-
- !ruby/object:Gem::Dependency
|
156
|
-
name: yard
|
157
|
-
requirement: !ruby/object:Gem::Requirement
|
158
|
-
requirements:
|
159
|
-
- - ">="
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
version: 0.9.20
|
162
|
-
type: :development
|
163
|
-
prerelease: false
|
164
|
-
version_requirements: !ruby/object:Gem::Requirement
|
165
|
-
requirements:
|
166
|
-
- - ">="
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
version: 0.9.20
|
169
43
|
description: Wrapper gem for DigitalOcean. Use in testing projects
|
170
44
|
email:
|
171
45
|
- shockwavenn@gmail.com
|
@@ -179,6 +53,7 @@ files:
|
|
179
53
|
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/digitalocean_exceptions.rb
|
180
54
|
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/exceptions_retryer.rb
|
181
55
|
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/getters.rb
|
56
|
+
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/ip_getters.rb
|
182
57
|
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/logger_wrapper.rb
|
183
58
|
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/power_actions.rb
|
184
59
|
- lib/onlyoffice_digitalocean_wrapper/digitalocean_wrapper/token_methods.rb
|
@@ -194,6 +69,7 @@ metadata:
|
|
194
69
|
documentation_uri: https://www.rubydoc.info/gems/onlyoffice_digitalocean_wrapper
|
195
70
|
homepage_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_digitalocean_wrapper
|
196
71
|
source_code_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_digitalocean_wrapper
|
72
|
+
rubygems_mfa_required: 'true'
|
197
73
|
post_install_message:
|
198
74
|
rdoc_options: []
|
199
75
|
require_paths:
|
@@ -202,14 +78,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
202
78
|
requirements:
|
203
79
|
- - ">="
|
204
80
|
- !ruby/object:Gem::Version
|
205
|
-
version: '
|
81
|
+
version: '3.0'
|
206
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
83
|
requirements:
|
208
84
|
- - ">="
|
209
85
|
- !ruby/object:Gem::Version
|
210
86
|
version: '0'
|
211
87
|
requirements: []
|
212
|
-
rubygems_version: 3.
|
88
|
+
rubygems_version: 3.5.6
|
213
89
|
signing_key:
|
214
90
|
specification_version: 4
|
215
91
|
summary: Wrapper gem for DigitalOcean
|