easy_manager 0.9.3 → 0.9.4

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: bfb1e50bc8e3aa5d0b6387b1464774ceab853e72e476bbfdde0235da92cb5fa5
4
- data.tar.gz: 559ec2811c9aed00b58e32e020635e8d0eb65e9843fd44168c5ecb16e66cc7b2
3
+ metadata.gz: ab9a57597bbf2084e8677c0744935cfc798c99c63cc07b4503568963f11c3d55
4
+ data.tar.gz: ba92b5d4810baa0bbb84348e52d8a55dd098c28f03771092d5c9c8df6a479f22
5
5
  SHA512:
6
- metadata.gz: ddded25e7989bf1e70dd6d13571f3e7d2ff7cbb998683d62c11c90102b8d781e3803b977f8c6b7b86342923602d10514bc8896b227506fa36820e59e054155c0
7
- data.tar.gz: bd1a66cfc21f9f3e6b541345114204fa00a335d46942d7b715df2c20101ed0e2654b0f94ba77739ac6e59a776611a13538112a2925d28fc6b6f997e0a3c1aee7
6
+ metadata.gz: dd711601f7aa4bba050f61fc1be56fd48d838892a4f15bfbf15c82c4488bb2b09fbcc5e40a5f26f5b7b00b3baa19fcff47e8992ee0fdc9efc7451ed9bc4bfc87
7
+ data.tar.gz: 8cd4d60852f38458df9f0379e8e2a1a5b217de125f7848ce0e4b1e79263bda328b0f588e5cb7a0882357ca4bca5741c5e084b18336870292490d92fd090884da
@@ -18,11 +18,16 @@ class EasyManager
18
18
  Utilities.parse_json(response.body)
19
19
  end
20
20
 
21
- def self.delete(scw, ip_id)
22
- Typhoeus.delete(
21
+ def self.delete(scw, ip_id, tries = 0)
22
+ resp = Typhoeus.delete(
23
23
  File.join(scw.api_url, "/instance/v1/zones/#{scw.zone}/ips/#{ip_id}"),
24
24
  headers: scw.headers
25
25
  )
26
+ return resp if resp&.code == 204
27
+
28
+ sleep(rand(10..60))
29
+ tries += 1
30
+ delete(scw, ip_id, tries) unless tries >= 3
26
31
  end
27
32
  end
28
33
  end
@@ -55,7 +55,7 @@ class EasyManager
55
55
  Servers.ready?(self, srv, ssh, srv_ready_cmds)
56
56
  end
57
57
 
58
- def wait_until_ready!(srv, ssh, timeout = 360)
58
+ def wait_until_ready!(srv, ssh, timeout = 600)
59
59
  ready = false
60
60
  start = Time.now
61
61
  loop do
@@ -87,13 +87,18 @@ class EasyManager
87
87
  )
88
88
  end
89
89
 
90
- def self.action(scw, srv_id, action)
90
+ def self.action(scw, srv_id, action, tries = 0)
91
91
  data = { action: action }
92
- Typhoeus.post(
92
+ resp = Typhoeus.post(
93
93
  File.join(scw.api_url, "/instance/v1/zones/#{scw.zone}/servers/#{srv_id}/action"),
94
94
  headers: scw.headers,
95
95
  body: data.to_json
96
96
  )
97
+ return resp if resp&.code == 202
98
+
99
+ sleep(rand(10..60))
100
+ tries += 1
101
+ action(scw, srv_id, action, tries) unless tries >= 3
97
102
  end
98
103
 
99
104
  def self.srv_data(scw, srv_type, image, name_pattern)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua MARTINELLE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-08 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt_pbkdf