fog-brightbox 0.2.0 → 0.3.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
  SHA1:
3
- metadata.gz: 3ba0fd5a2af49de6bfd1c985302496ca96f0368c
4
- data.tar.gz: 59f4dec412be2a7f9bd2f77585e4c045f62741a0
3
+ metadata.gz: 9c828f450aae49fe5ef940159c7cdaee50804594
4
+ data.tar.gz: 6ab4e5663ebb90199b0e01b8d38cf117479c4d27
5
5
  SHA512:
6
- metadata.gz: 6df22c1e489650cbf363a0c12f1a382235293108dc145ca089fb996d1720fed5a0e0de11e0120374102d75c4980541db203f681169f8af40ec0aa0729250017a
7
- data.tar.gz: 8c186b06909f62c6d395a4ce85bfaa190ece428d761859dee413bc1b883ae4145282e15bb114d330bdadbad57ef495d30dde860d68c98b520b0915af371c929b
6
+ metadata.gz: d7ba85e84d50f9689c9262836196c02629e470613d26cbd403c0319f16cc513bc09d06ca8d7f0e4762cbe2dec4f0dc4212058bb9289e35702c3d27a20e480381
7
+ data.tar.gz: 19d9f5dfac3c1825c9bc21749a1baf5ff68c4f0b87a3a210c519dd90837c2e0fcf19a008a6c037ed4ebf106cbbf4d9543873d798abf2a3b29f124a17b1849e9b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 0.3.0 / 2014-08-12
2
+
3
+ Enhancements:
4
+
5
+ * Use improved reset and reboot requests for the `Server#reboot` method
6
+ allowing requests without having to fake restarts with a start/stop. This
7
+ keeps the VNC console active.
8
+
1
9
  ### 0.2.0 / 2014-08-07
2
10
 
3
11
  Enhancements:
@@ -144,6 +144,7 @@ module Fog
144
144
  request :lock_resource_server
145
145
  request :map_cloud_ip
146
146
  request :move_servers_server_group
147
+ request :reboot_server
147
148
  request :reject_user_collaboration
148
149
  request :remove_listeners_load_balancer
149
150
  request :remove_nodes_load_balancer
@@ -154,6 +155,7 @@ module Fog
154
155
  request :reset_password_database_server
155
156
  request :reset_secret_api_client
156
157
  request :reset_secret_application
158
+ request :reset_server
157
159
  request :resend_collaboration
158
160
  request :reject_user_collaboration
159
161
  request :shutdown_server
@@ -74,21 +74,26 @@ module Fog
74
74
  service.snapshot_server(identity)
75
75
  end
76
76
 
77
- # Directly requesting a server reboot is not supported in the API
78
- # so needs to attempt a shutdown/stop, wait and start again.
77
+ # Issues a hard reset to the server (or an OS level reboot command)
79
78
  #
80
79
  # Default behaviour is a hard reboot because it is more reliable
81
80
  # because the state of the server's OS is irrelevant.
82
81
  #
82
+ # @example Hard reset
83
+ # @server.reboot
84
+ #
85
+ # @example Soft reset
86
+ # @server.reboot(false)
87
+ #
83
88
  # @param [Boolean] use_hard_reboot
84
89
  # @return [Boolean]
85
90
  def reboot(use_hard_reboot = true)
86
91
  requires :identity
87
92
  if ready?
88
93
  if use_hard_reboot
89
- hard_reboot
94
+ service.reset_server(identity)
90
95
  else
91
- soft_reboot
96
+ service.reboot_server(identity)
92
97
  end
93
98
  else
94
99
  # Not able to reboot if not ready in the first place
@@ -188,30 +193,6 @@ module Fog
188
193
  def mapping_identity
189
194
  interfaces.first["id"]
190
195
  end
191
-
192
- private
193
-
194
- # Hard reboots are fast, avoiding the OS by doing a "power off"
195
- def hard_reboot
196
- stop
197
- wait_for { !ready? }
198
- start
199
- end
200
-
201
- # Soft reboots often timeout if the OS missed the request so we do more
202
- # error checking trying to detect the timeout
203
- #
204
- # @todo Needs cleaner error handling when the OS times out
205
- def soft_reboot
206
- shutdown
207
- # FIXME: Using side effect of wait_for's (evaluated block) to detect timeouts
208
- begin
209
- wait_for(20) { !ready? }
210
- start
211
- rescue Fog::Errors::Timeout
212
- false
213
- end
214
- end
215
196
  end
216
197
  end
217
198
  end
@@ -0,0 +1,21 @@
1
+ module Fog
2
+ module Compute
3
+ class Brightbox
4
+ class Real
5
+ # Shuts down and resets the server without disconnecting the console.
6
+ #
7
+ # @param [String] identifier Unique reference to identify the resource
8
+ #
9
+ # @return [Hash] if successful Hash version of JSON object
10
+ #
11
+ # @see https://api.gb1.brightbox.com/1.0/#server_reboot_server
12
+ #
13
+ def reboot_server(identifier)
14
+ return nil if identifier.nil? || identifier == ""
15
+ wrapped_request("post", "/1.0/servers/#{identifier}/reboot", [202])
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module Fog
2
+ module Compute
3
+ class Brightbox
4
+ class Real
5
+ # Resets the server without disconnecting the console.
6
+ #
7
+ # @param [String] identifier Unique reference to identify the resource
8
+ #
9
+ # @return [Hash] if successful Hash version of JSON object
10
+ #
11
+ # @see https://api.gb1.brightbox.com/1.0/#server_reset_server
12
+ #
13
+ def reset_server(identifier)
14
+ return nil if identifier.nil? || identifier == ""
15
+ wrapped_request("post", "/1.0/servers/#{identifier}/reset", [202])
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Brightbox
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-brightbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Thornthwaite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-07 00:00:00.000000000 Z
11
+ date: 2014-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -263,6 +263,7 @@ files:
263
263
  - lib/fog/brightbox/requests/compute/lock_resource_server.rb
264
264
  - lib/fog/brightbox/requests/compute/map_cloud_ip.rb
265
265
  - lib/fog/brightbox/requests/compute/move_servers_server_group.rb
266
+ - lib/fog/brightbox/requests/compute/reboot_server.rb
266
267
  - lib/fog/brightbox/requests/compute/reject_user_collaboration.rb
267
268
  - lib/fog/brightbox/requests/compute/remove_firewall_policy.rb
268
269
  - lib/fog/brightbox/requests/compute/remove_listeners_load_balancer.rb
@@ -274,6 +275,7 @@ files:
274
275
  - lib/fog/brightbox/requests/compute/reset_password_database_server.rb
275
276
  - lib/fog/brightbox/requests/compute/reset_secret_api_client.rb
276
277
  - lib/fog/brightbox/requests/compute/reset_secret_application.rb
278
+ - lib/fog/brightbox/requests/compute/reset_server.rb
277
279
  - lib/fog/brightbox/requests/compute/shutdown_server.rb
278
280
  - lib/fog/brightbox/requests/compute/snapshot_database_server.rb
279
281
  - lib/fog/brightbox/requests/compute/snapshot_server.rb