solusvm 1.3.1 → 1.4.0
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 +4 -4
- data/lib/solusvm/base.rb +2 -0
- data/lib/solusvm/server.rb +9 -3
- data/lib/solusvm/version.rb +1 -1
- data/test/solusvm/test_server.rb +7 -0
- data/test/vcr_cassettes/server/console.yml +13 -0
- data/test/vcr_cassettes/server/create.yml +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c51edb4b2a1565f254f3764f713865e60c9f0b7
|
4
|
+
data.tar.gz: d0940f9709bd079e7e68d7d95675e7a3c629a4c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ea7f18ed0eea58289cd486fe03d81b754d5a474bd75250d2fc8e8363ccd0b4d83909c41e5d497a9c2a5f93d550ef38512340b68e720bd4ad466a2df92a1c8e4
|
7
|
+
data.tar.gz: dbb3c21df6def9db1cabee02f789978c3fa245b7d9f25782c84cacd79f085e407c494484fca18e66372f5225a5a71d1b6de620d7d7eb9122e8d40ba6e6aae7c8
|
data/lib/solusvm/base.rb
CHANGED
@@ -26,6 +26,8 @@ module Solusvm
|
|
26
26
|
ca_path = File.join(File.dirname(__FILE__), "..", "cacert.pem")
|
27
27
|
ssl = {verify: true, ca_file: File.expand_path(ca_path)}
|
28
28
|
|
29
|
+
options.reject! {|_,v| v.nil? }
|
30
|
+
|
29
31
|
response = Faraday.new(url: api_endpoint, ssl: ssl) do |c|
|
30
32
|
c.params = options.merge(api_login)
|
31
33
|
c.adapter :net_http
|
data/lib/solusvm/server.rb
CHANGED
@@ -165,11 +165,17 @@ module Solusvm
|
|
165
165
|
end
|
166
166
|
|
167
167
|
# Retrieves server console information.
|
168
|
-
|
169
|
-
|
168
|
+
#
|
169
|
+
# params - A Hash to pass optional parameters to vserver-console call:
|
170
|
+
# :access - A String that can be 'enable' or 'disable'
|
171
|
+
# :time - A Integer that can be 1|2|3|4|5|6|7|8
|
172
|
+
#
|
173
|
+
# returns a Hash
|
174
|
+
def console(vid, params = {})
|
175
|
+
perform_request(action: 'vserver-console', vserverid: vid, access: params[:access], time: params[:time])
|
170
176
|
returned_parameters
|
171
177
|
end
|
172
|
-
|
178
|
+
|
173
179
|
# Retrieves all available server information.
|
174
180
|
def info_all(vid)
|
175
181
|
perform_request(action: 'vserver-infoall', vserverid: vid)
|
data/lib/solusvm/version.rb
CHANGED
data/test/solusvm/test_server.rb
CHANGED
@@ -228,6 +228,13 @@ class TestServer < Test::Unit::TestCase
|
|
228
228
|
assert_equal 'theconsoleport', info['consoleport']
|
229
229
|
assert_equal 'theconsolepassword', info['consolepassword']
|
230
230
|
assert_equal 'theconsoleusername', info['consoleusername']
|
231
|
+
|
232
|
+
# with the optional parameters
|
233
|
+
VCR.use_cassette "server/console" do
|
234
|
+
@server.console(1, access: "admin", time: 1)
|
235
|
+
end
|
236
|
+
# a check to see if it returned a expected parameter even with the optional parameter
|
237
|
+
assert_equal 'thetype', @server.returned_parameters['type']
|
231
238
|
end
|
232
239
|
|
233
240
|
def test_info_all
|
@@ -12,4 +12,17 @@ http_interactions:
|
|
12
12
|
body: <status>success</status><statusmsg></statusmsg> <type>thetype</type><consoleip>theconsoleip</consoleip><consoleport>theconsoleport</consoleport><consolepassword>theconsolepassword</consolepassword><consoleusername>theconsoleusername</consoleusername>
|
13
13
|
http_version: '1.1'
|
14
14
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
15
|
+
- request:
|
16
|
+
method: get
|
17
|
+
uri: http://www.example.com/api?action=vserver-console&vserverid=1&access=admin&time=1&id=api_id&key=api_key
|
18
|
+
body: ''
|
19
|
+
headers: {}
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
body: <status>success</status><statusmsg></statusmsg> <type>thetype</type><consoleip>theconsoleip</consoleip><consoleport>theconsoleport</consoleport><consolepassword>theconsolepassword</consolepassword><consoleusername>theconsoleusername</consoleusername>
|
25
|
+
http_version: '1.1'
|
26
|
+
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
27
|
+
|
15
28
|
recorded_with: VCR 2.0.0
|
@@ -14,7 +14,7 @@ http_interactions:
|
|
14
14
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
15
15
|
- request:
|
16
16
|
method: get
|
17
|
-
uri: http://www.example.com/api?type=xen&
|
17
|
+
uri: http://www.example.com/api?type=xen&ips=1&password=&hostname=&action=vserver-create&id=api_id&key=api_key
|
18
18
|
body: ''
|
19
19
|
headers: {}
|
20
20
|
response:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solusvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Mazzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xml-simple
|