fog-rackspace 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9f5fb4bc4f48c23bf88fc1c1f8073ff163fdfbc
4
- data.tar.gz: 2db4733aeda2d7fbab008c50f1172a787951fc15
3
+ metadata.gz: 154e452a3dea52501efcbaaf0c6593d925c5ef7e
4
+ data.tar.gz: fcc716ba357aec449bf7877881a2f7a6684189ec
5
5
  SHA512:
6
- metadata.gz: 276233a70b94b97d82625f66fb6e1329a52db6420b4b07a1d85d2c9b1e964c2ce3e603504cd49ffcbb6697855b0502ac5bfc3784617db693f993ab814877c6e7
7
- data.tar.gz: f66a294850815c20430ecddf008f8e41acb65c22ae9a0eb2cde11dde114a0d3debda95a62f627e5d857bfad650bfa0324f2b7047df28ba785205f974e1d97fe7
6
+ metadata.gz: b59e56655f90889089cc72300e60a88fc70d275f20b1269aec792189180f27d69c502b27421b1a1637481d4237607a8bf6fe35711f5ddf017d4e34962dac1271
7
+ data.tar.gz: 5406cf428af959fc21d59385e1098434442d2db59f523e1c4a5b5ed0f707b53f32b0b625690a11df1e0872d47228ed505067fd236f61ba2c7638f67c0cf73ebe
@@ -81,6 +81,8 @@ module Fog
81
81
  request :unrescue_server
82
82
  request :list_addresses
83
83
  request :list_addresses_by_network
84
+ request :start_server
85
+ request :stop_server
84
86
 
85
87
  request :create_image
86
88
  request :list_images
@@ -519,6 +519,39 @@ module Fog
519
519
  true
520
520
  end
521
521
 
522
+ # This operation starts a stopped server, and changes its status to ACTIVE.
523
+ # Prior to running this command, the server status must be SHUTTOFF
524
+ # @param [String] server_id id of server to rescue
525
+ # @return [Boolean] returns true if call to put server in ACTIVE mode reports success
526
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
527
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
528
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
529
+ # @raise [Fog::Rackspace::Errors::ServiceError]
530
+ # @note Rescue mode is only guaranteed to be active for 90 minutes
531
+ # @see https://developer.rackspace.com/docs/cloud-servers/v2/api-reference/svr-basic-operations/#start-specified-server
532
+ def start
533
+ requires :identity
534
+ service.start_server(identity)
535
+ true
536
+ end
537
+
538
+ # This operation stops a running server, and changes the server status to SHUTOFF
539
+ # and changes the clean_shutdown parameter to TRUE.
540
+ # Prior to running this command, the server status must be ACTIVE or ERROR.
541
+ # @param [String] server_id id of server to rescue
542
+ # @return [Boolean] returns true if call to put server in SHUTOFF mode reports success
543
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
544
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
545
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
546
+ # @raise [Fog::Rackspace::Errors::ServiceError]
547
+ # @note Rescue mode is only guaranteed to be active for 90 minutes
548
+ # @see https://developer.rackspace.com/docs/cloud-servers/v2/api-reference/svr-basic-operations/#stop-specified-server
549
+ def stop
550
+ requires :identity
551
+ service.stop_server(identity)
552
+ true
553
+ end
554
+
522
555
  # Place existing server into rescue mode, allowing for offline editing of configuration. The original server's disk is attached to a new instance of the same base image for a period of time to facilitate working within rescue mode. The original server will be automatically restored after 90 minutes.
523
556
  # @return [Boolean] returns true if call to put server in rescue mode reports success
524
557
  # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
@@ -0,0 +1,39 @@
1
+ module Fog
2
+ module Compute
3
+ class RackspaceV2
4
+ class Real
5
+ # This operation starts a stopped server, and changes its status to ACTIVE.
6
+ # Prior to running this command, the server status must be SHUTTOFF
7
+ # @param [String] server_id id of server to rescue
8
+ # @return [Excon::Response] response
9
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
10
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
11
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
12
+ # @raise [Fog::Rackspace::Errors::ServiceError]
13
+ # @note Rescue mode is only guaranteed to be active for 90 minutes
14
+ # @see https://developer.rackspace.com/docs/cloud-servers/v2/api-reference/svr-basic-operations/#start-specified-server
15
+
16
+ def start_server(server_id)
17
+ data = {
18
+ 'os-start' => nil
19
+ }
20
+
21
+ request(
22
+ :body => Fog::JSON.encode(data),
23
+ :expects => [202],
24
+ :method => 'POST',
25
+ :path => "servers/#{server_id}/action"
26
+ )
27
+ end
28
+ end
29
+
30
+ class Mock
31
+ def start_server(server_id)
32
+ server = self.data[:servers][server_id]
33
+ server["status"] = "ACTIVE"
34
+ response(:status => 202)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,40 @@
1
+ module Fog
2
+ module Compute
3
+ class RackspaceV2
4
+ class Real
5
+ # This operation stops a running server, and changes the server status to SHUTOFF
6
+ # and changes the clean_shutdown parameter to TRUE.
7
+ # Prior to running this command, the server status must be ACTIVE or ERROR.
8
+ # @param [String] server_id id of server to rescue
9
+ # @return [Excon::Response] response
10
+ # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
11
+ # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
12
+ # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
13
+ # @raise [Fog::Rackspace::Errors::ServiceError]
14
+ # @note Rescue mode is only guaranteed to be active for 90 minutes
15
+ # @see https://developer.rackspace.com/docs/cloud-servers/v2/api-reference/svr-basic-operations/#stop-specified-server
16
+
17
+ def stop_server(server_id)
18
+ data = {
19
+ 'os-stop' => nil
20
+ }
21
+
22
+ request(
23
+ :body => Fog::JSON.encode(data),
24
+ :expects => [202],
25
+ :method => 'POST',
26
+ :path => "servers/#{server_id}/action"
27
+ )
28
+ end
29
+ end
30
+
31
+ class Mock
32
+ def stop_server(server_id)
33
+ server = self.data[:servers][server_id]
34
+ server["status"] = "SHUTOFF"
35
+ response(:status => 202)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Rackspace
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
@@ -150,6 +150,18 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
150
150
  end
151
151
 
152
152
  @instance.wait_for { ready?('RESCUE') }
153
+ tests('#start').succeeds do
154
+ @instance.start
155
+ end
156
+
157
+ sleep 30 unless Fog.mocking?
158
+ @instance.wait_for { ready?('ACTIVE') }
159
+ tests('#stop').succeeds do
160
+ @instance.stop
161
+ end
162
+
163
+ sleep 30 unless Fog.mocking?
164
+ @instance.wait_for { ready?('SHUTOFF') }
153
165
  tests('#unrescue').succeeds do
154
166
  @instance.unrescue
155
167
  end
@@ -156,6 +156,17 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do
156
156
  end
157
157
  wait_for_server_state(service, server_id, 'RESCUE', 'ACTIVE')
158
158
 
159
+ tests('#start_server').formats(rescue_server_format, false) do
160
+ service.start_server(server_id)
161
+ end
162
+ wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR')
163
+
164
+
165
+ tests('#stop_server').formats(rescue_server_format, false) do
166
+ service.stop_server(server_id)
167
+ end
168
+ wait_for_server_state(service, server_id, 'SHUTOFF')
169
+
159
170
  tests('#unrescue_server').succeeds do
160
171
  service.unrescue_server(server_id)
161
172
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-rackspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-05 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -530,6 +530,8 @@ files:
530
530
  - lib/fog/rackspace/requests/compute_v2/revert_resize_server.rb
531
531
  - lib/fog/rackspace/requests/compute_v2/set_metadata.rb
532
532
  - lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb
533
+ - lib/fog/rackspace/requests/compute_v2/start_server.rb
534
+ - lib/fog/rackspace/requests/compute_v2/stop_server.rb
533
535
  - lib/fog/rackspace/requests/compute_v2/unrescue_server.rb
534
536
  - lib/fog/rackspace/requests/compute_v2/update_metadata.rb
535
537
  - lib/fog/rackspace/requests/compute_v2/update_server.rb