upcloud_api 1.1.0 → 1.2.0.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/upcloud_api/version.rb +1 -1
- data/lib/upcloud_api.rb +13 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: becf22140f3d61a6e08668562b19df3bb9b5f585
|
4
|
+
data.tar.gz: 7bc9ed1e86f489a6ce958c036816e921f3693651
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58e8408ae341460b75a896047f72f156cc577704947f95630b167c3be28451fc80740d1863b6197907ac8373bdacf4a533ec7d3afc618a77acb6c791699a459e
|
7
|
+
data.tar.gz: fec1c2166a467f1cc58b67c1a696479fa67c5accf31f64866f76a9d28edbcb97f89ddd6e44fc8d65cfb444f9bf71492364ac17fe757b06f57760dcad1ca179a1
|
data/lib/upcloud_api/version.rb
CHANGED
data/lib/upcloud_api.rb
CHANGED
@@ -152,7 +152,10 @@ class UpcloudApi
|
|
152
152
|
# @param server_uuid UUID of the server
|
153
153
|
# @param type Type of the shutdown. Available types are :hard and :soft. Defaults to :soft.
|
154
154
|
# @param timeout Time after server will be hard stopped if it didn’t close cleanly. Only affects :soft type.
|
155
|
-
|
155
|
+
# @param asynchronous If false, this call will wait until the server has really stopped.
|
156
|
+
#
|
157
|
+
# Raises Timeout::Error in case server does not shut down in 300 seconds in non-asynchronous mode.
|
158
|
+
def stop_server server_uuid, type: :soft, timeout: nil, asynchronous: false
|
156
159
|
data = {
|
157
160
|
"stop_server" => {
|
158
161
|
"stop_type" => type.to_s
|
@@ -164,7 +167,14 @@ class UpcloudApi
|
|
164
167
|
|
165
168
|
response = post "server/#{server_uuid}/stop", json
|
166
169
|
|
167
|
-
response
|
170
|
+
return response if asynchronous
|
171
|
+
|
172
|
+
Timeout 300 do
|
173
|
+
loop do
|
174
|
+
details = server_details server_uuid
|
175
|
+
return response if details["server"]["state"] == "stopped"
|
176
|
+
end
|
177
|
+
end
|
168
178
|
end
|
169
179
|
|
170
180
|
# Restarts down a server that is currently running
|
@@ -180,7 +190,7 @@ class UpcloudApi
|
|
180
190
|
# @param timeout Time after server will be hard stopped if it didn’t close cleanly. Only affects :soft type.
|
181
191
|
# @param timeout_action What will happen when timeout happens. :destroy hard stops the server and :ignore makes
|
182
192
|
# server if timeout happens. Default is :ignore.
|
183
|
-
def
|
193
|
+
def restart_server server_uuid, type: :soft, timeout: nil, timeout_action: :ignore
|
184
194
|
data = {
|
185
195
|
"stop_server" => {
|
186
196
|
"stop_type" => type.to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upcloud_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0.pre.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samu Voutilainen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -48,9 +48,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: '0'
|
49
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 1.3.1
|
54
54
|
requirements: []
|
55
55
|
rubyforge_project:
|
56
56
|
rubygems_version: 2.4.6
|