solusvm 0.7.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -3
- data/.rbenv-version +1 -0
- data/.rvmrc +47 -0
- data/.travis.yml +11 -0
- data/Gemfile +4 -2
- data/README.markdown +28 -19
- data/Rakefile +19 -34
- data/lib/solusvm/server.rb +10 -0
- data/lib/solusvm/version.rb +3 -0
- data/solusvm.gemspec +21 -93
- data/test/fixtures/server_change_success.txt +2 -0
- data/test/fixtures/server_info_success.txt +10 -0
- data/test/fixtures/server_infoall_success.txt +13 -0
- data/test/helper.rb +6 -4
- data/test/test_base.rb +1 -1
- data/test/test_client.rb +2 -2
- data/test/test_general.rb +1 -1
- data/test/test_hash.rb +2 -2
- data/test/test_server.rb +41 -5
- data/test/test_solusvm.rb +1 -1
- metadata +110 -20
- data/Gemfile.lock +0 -13
- data/VERSION.yml +0 -5
data/.gitignore
CHANGED
data/.rbenv-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.8.7-p352
|
data/.rvmrc
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
+
# development environment upon cd'ing into the directory
|
5
|
+
|
6
|
+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
|
7
|
+
environment_id="ruby-1.9.2-p290@solusvm"
|
8
|
+
|
9
|
+
#
|
10
|
+
# Uncomment following line if you want options to be set only for given project.
|
11
|
+
#
|
12
|
+
# PROJECT_JRUBY_OPTS=( --1.9 )
|
13
|
+
|
14
|
+
#
|
15
|
+
# First we attempt to load the desired environment directly from the environment
|
16
|
+
# file. This is very fast and efficient compared to running through the entire
|
17
|
+
# CLI and selector. If you want feedback on which environment was used then
|
18
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
19
|
+
#
|
20
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
21
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
22
|
+
then
|
23
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
24
|
+
|
25
|
+
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
|
26
|
+
then
|
27
|
+
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
|
28
|
+
fi
|
29
|
+
else
|
30
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
31
|
+
if ! rvm --create use "$environment_id"
|
32
|
+
then
|
33
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
34
|
+
exit 1
|
35
|
+
fi
|
36
|
+
fi
|
37
|
+
|
38
|
+
#
|
39
|
+
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
|
40
|
+
# it be automatically loaded. Uncomment the following and adjust the filename if
|
41
|
+
# necessary.
|
42
|
+
#
|
43
|
+
# filename=".gems"
|
44
|
+
# if [[ -s "$filename" ]] ; then
|
45
|
+
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
|
46
|
+
# fi
|
47
|
+
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -1,11 +1,19 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
SolusVM [![SolusVM Build Status][Build Icon]][Build Status]
|
2
|
+
===========================================================
|
3
3
|
|
4
|
-
|
5
|
-
This library was first created for internal use at
|
4
|
+
SolusVM allows for easy interaction with the [SolusVM Admin::API][].
|
5
|
+
This library was first created for internal use at [Site5 LLC][].
|
6
|
+
|
7
|
+
SolusVM has been tested on MRI 1.8.7, MRI 1.9.2, MRI 1.9.3 Preview 1,
|
8
|
+
Rubinius 2.0, and JRuby 1.6.2.
|
9
|
+
|
10
|
+
[Site5 LLC]: http://www.site5.com
|
11
|
+
[SolusVM Admin::API]: http://wiki.solusvm.com/index.php/API:Admin
|
12
|
+
[Build Status]: http://travis-ci.org/site5/solusvm
|
13
|
+
[Build Icon]: https://secure.travis-ci.org/site5/solusvm.png?branch=master
|
6
14
|
|
7
15
|
Basic Examples
|
8
|
-
|
16
|
+
--------------
|
9
17
|
|
10
18
|
Solusvm.config('api_id', 'api_password', :url => 'http://www.example.com/api')
|
11
19
|
server = Solusvm::Server.new
|
@@ -18,7 +26,7 @@ Basic Examples
|
|
18
26
|
server.resume(200) # => true
|
19
27
|
|
20
28
|
Server creation
|
21
|
-
|
29
|
+
---------------
|
22
30
|
|
23
31
|
options = {:type => 'xen', :username => 'bob', :node => 'node1', :plan => 'plan1', :template => 'mytpl', :ips => 1}
|
24
32
|
result = sever.create('server.hostname.com', 'password', options}
|
@@ -30,9 +38,8 @@ Server creation
|
|
30
38
|
"statusmsg"=>"Virtual server created", "virtid"=>"vm10", "consolepassword"=>"myPassisL33t",
|
31
39
|
"extraipaddress"=>{}, "hostname"=>"server.hostname", "rootpassword"=>"password", "status"=>"success"}
|
32
40
|
|
33
|
-
|
34
41
|
Command Line Usage
|
35
|
-
|
42
|
+
------------------
|
36
43
|
|
37
44
|
USAGE: solusvm <command> [options]
|
38
45
|
-I, --api-login [id] API ID
|
@@ -60,7 +67,7 @@ Command Line Usage
|
|
60
67
|
server-addip <vserverid>
|
61
68
|
|
62
69
|
Default Config for Command Line
|
63
|
-
|
70
|
+
--------------------------------
|
64
71
|
|
65
72
|
The command line utility, solusvm, will look for a .solusvm.yml file in ~/. You can specify some defaults.
|
66
73
|
|
@@ -72,31 +79,33 @@ The command line utility, solusvm, will look for a .solusvm.yml file in ~/. You
|
|
72
79
|
# Default client to put servers under
|
73
80
|
username: bob
|
74
81
|
|
75
|
-
|
76
|
-
|
82
|
+
Requirements
|
83
|
+
------------
|
77
84
|
|
78
85
|
* xml-simple
|
79
86
|
|
80
|
-
|
81
|
-
|
87
|
+
Documentation
|
88
|
+
-------------
|
82
89
|
|
83
90
|
* http://solusvm.rubyforge.org/solusvm/
|
84
91
|
|
85
|
-
|
86
|
-
|
92
|
+
Installation
|
93
|
+
------------
|
87
94
|
|
88
95
|
gem install solusvm
|
89
96
|
|
90
97
|
Contributors
|
91
|
-
|
98
|
+
------------
|
92
99
|
|
93
100
|
* [Justin Mazzi](http://github.com/jmazzi)
|
94
101
|
* [Maran H.](http://github.com/maran)
|
102
|
+
* [Joshua Priddle](http://github.com/itspriddle)
|
95
103
|
|
96
104
|
Note on Patches/Pull Requests
|
97
|
-
|
105
|
+
-----------------------------
|
98
106
|
|
99
107
|
* Fork the project.
|
108
|
+
* Add yourself to the Contributors list
|
100
109
|
* Make your feature addition or bug fix.
|
101
110
|
* Add tests for it. This is important so I don't break it in a
|
102
111
|
future version unintentionally.
|
@@ -105,6 +114,6 @@ Note on Patches/Pull Requests
|
|
105
114
|
* Send me a pull request. Bonus points for topic branches.
|
106
115
|
|
107
116
|
Copyright
|
108
|
-
|
117
|
+
---------
|
109
118
|
|
110
|
-
Copyright (c) 2010 Site5. See LICENSE for details.
|
119
|
+
Copyright (c) 2010-2011 Site5. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,32 +1,12 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "solusvm"
|
8
|
-
gem.summary = "Wrapper for the SolusVM Admin::API"
|
9
|
-
gem.description = "Solusvm allows for easy interaction with the SolusVM Admin::API."
|
10
|
-
gem.email = "jmazzi@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/site5/solusvm"
|
12
|
-
gem.authors = ["Justin Mazzi"]
|
13
|
-
gem.add_dependency 'xml-simple'
|
14
|
-
gem.rubyforge_project = 'solusvm'
|
15
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
-
end
|
17
|
-
|
18
|
-
Jeweler::RubyforgeTasks.new do |rubyforge|
|
19
|
-
rubyforge.doc_task = "rdoc"
|
20
|
-
end
|
21
|
-
Jeweler::GemcutterTasks.new
|
22
|
-
rescue LoadError
|
23
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
24
|
-
end
|
3
|
+
require 'bundler/gem_tasks'
|
25
4
|
|
26
5
|
require 'rake/testtask'
|
6
|
+
|
27
7
|
Rake::TestTask.new(:test) do |test|
|
28
8
|
test.libs << 'lib' << 'test'
|
29
|
-
test.
|
9
|
+
test.test_files = FileList['test/**/test_*.rb']
|
30
10
|
test.verbose = true
|
31
11
|
end
|
32
12
|
|
@@ -43,16 +23,21 @@ rescue LoadError
|
|
43
23
|
end
|
44
24
|
end
|
45
25
|
|
46
|
-
|
26
|
+
begin
|
27
|
+
require 'rdoc/task'
|
28
|
+
Rake::RDocTask.new do |rdoc|
|
29
|
+
version = Solusvm::VERSION
|
30
|
+
|
31
|
+
rdoc.rdoc_dir = 'rdoc'
|
32
|
+
rdoc.title = "solusvm #{version}"
|
33
|
+
rdoc.rdoc_files.include('README*')
|
34
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
task :rdoc do
|
38
|
+
abort "rdoc is not available. In order to run rdoc, you must: sudo gem install rdoc"
|
39
|
+
end
|
40
|
+
end
|
47
41
|
|
48
42
|
task :default => :test
|
49
|
-
|
50
|
-
require 'rake/rdoctask'
|
51
|
-
Rake::RDocTask.new do |rdoc|
|
52
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
53
|
-
|
54
|
-
rdoc.rdoc_dir = 'rdoc'
|
55
|
-
rdoc.title = "solusvm #{version}"
|
56
|
-
rdoc.rdoc_files.include('README*')
|
57
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
58
|
-
end
|
43
|
+
task :spec => :test
|
data/lib/solusvm/server.rb
CHANGED
@@ -56,5 +56,15 @@ module Solusvm
|
|
56
56
|
def change_plan(vid, plan)
|
57
57
|
perform_request(:action => 'vserver-change', :vserverid => vid, :plan => plan)
|
58
58
|
end
|
59
|
+
|
60
|
+
def info(vid, reboot = false)
|
61
|
+
perform_request(:action => 'vserver-info', :vserverid => vid, :reboot => reboot)
|
62
|
+
returned_parameters
|
63
|
+
end
|
64
|
+
|
65
|
+
def info_all(vid)
|
66
|
+
perform_request(:action => 'vserver-infoall', :vserverid => vid)
|
67
|
+
returned_parameters
|
68
|
+
end
|
59
69
|
end
|
60
70
|
end
|
data/solusvm.gemspec
CHANGED
@@ -1,100 +1,28 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "solusvm/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version =
|
6
|
+
s.name = %q{solusvm}
|
7
|
+
s.version = Solusvm::VERSION
|
9
8
|
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.description =
|
15
|
-
s.email = %q{jmazzi@gmail.com}
|
16
|
-
s.executables = ["solusvm"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE",
|
19
|
-
"README.markdown"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
".gitignore",
|
24
|
-
"Gemfile",
|
25
|
-
"Gemfile.lock",
|
26
|
-
"LICENSE",
|
27
|
-
"README.markdown",
|
28
|
-
"Rakefile",
|
29
|
-
"VERSION.yml",
|
30
|
-
"bin/solusvm",
|
31
|
-
"lib/solusvm.rb",
|
32
|
-
"lib/solusvm/base.rb",
|
33
|
-
"lib/solusvm/client.rb",
|
34
|
-
"lib/solusvm/exceptions.rb",
|
35
|
-
"lib/solusvm/general.rb",
|
36
|
-
"lib/solusvm/hash.rb",
|
37
|
-
"lib/solusvm/server.rb",
|
38
|
-
"solusvm.gemspec",
|
39
|
-
"test/fixtures/base_bad_key.txt",
|
40
|
-
"test/fixtures/base_node_does_not_exist.txt",
|
41
|
-
"test/fixtures/base_unauthorized_ip.txt",
|
42
|
-
"test/fixtures/client_authenticate_error.txt",
|
43
|
-
"test/fixtures/client_authenticate_success.txt",
|
44
|
-
"test/fixtures/client_change_password_error.txt",
|
45
|
-
"test/fixtures/client_change_password_success.txt",
|
46
|
-
"test/fixtures/client_create_error.txt",
|
47
|
-
"test/fixtures/client_create_success.txt",
|
48
|
-
"test/fixtures/client_exists_success.txt",
|
49
|
-
"test/fixtures/error.txt",
|
50
|
-
"test/fixtures/general_node_list_all_ips_available.txt",
|
51
|
-
"test/fixtures/general_node_list_all_ips_not_available.txt",
|
52
|
-
"test/fixtures/general_node_statistics_success.txt",
|
53
|
-
"test/fixtures/general_nodes_success.txt",
|
54
|
-
"test/fixtures/general_templates_success.txt",
|
55
|
-
"test/fixtures/server_boot_success.txt",
|
56
|
-
"test/fixtures/server_create_success.txt",
|
57
|
-
"test/fixtures/server_exists_success.txt",
|
58
|
-
"test/fixtures/server_reboot_success.txt",
|
59
|
-
"test/fixtures/server_resume_success.txt",
|
60
|
-
"test/fixtures/server_shutdown_success.txt",
|
61
|
-
"test/fixtures/server_suspend_success.txt",
|
62
|
-
"test/fixtures/server_terminate_success.txt",
|
63
|
-
"test/helper.rb",
|
64
|
-
"test/test_base.rb",
|
65
|
-
"test/test_client.rb",
|
66
|
-
"test/test_general.rb",
|
67
|
-
"test/test_hash.rb",
|
68
|
-
"test/test_server.rb",
|
69
|
-
"test/test_solusvm.rb"
|
70
|
-
]
|
71
|
-
s.homepage = %q{http://github.com/site5/solusvm}
|
72
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
73
|
-
s.require_paths = ["lib"]
|
74
|
-
s.rubyforge_project = %q{solusvm}
|
75
|
-
s.rubygems_version = %q{1.3.7}
|
76
|
-
s.summary = %q{Wrapper for the SolusVM Admin::API}
|
77
|
-
s.test_files = [
|
78
|
-
"test/helper.rb",
|
79
|
-
"test/test_base.rb",
|
80
|
-
"test/test_client.rb",
|
81
|
-
"test/test_general.rb",
|
82
|
-
"test/test_hash.rb",
|
83
|
-
"test/test_server.rb",
|
84
|
-
"test/test_solusvm.rb"
|
85
|
-
]
|
9
|
+
s.authors = ["Justin Mazzi"]
|
10
|
+
s.email = ["jmazzi@gmail.com"]
|
11
|
+
s.homepage = "http://www.site5.com"
|
12
|
+
s.summary = "Wrapper for the SolusVM Admin::API"
|
13
|
+
s.description = "Solusvm allows for easy interaction with the SolusVM Admin::API."
|
86
14
|
|
87
|
-
|
88
|
-
|
89
|
-
|
15
|
+
s.rubyforge_project = "solusvm"
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
90
20
|
|
91
|
-
|
92
|
-
|
93
|
-
else
|
94
|
-
s.add_dependency(%q<xml-simple>, [">= 0"])
|
95
|
-
end
|
96
|
-
else
|
97
|
-
s.add_dependency(%q<xml-simple>, [">= 0"])
|
98
|
-
end
|
99
|
-
end
|
21
|
+
s.add_runtime_dependency 'xml-simple'
|
22
|
+
s.add_runtime_dependency 'jruby-openssl' if RUBY_PLATFORM == 'java'
|
100
23
|
|
24
|
+
s.add_development_dependency 'redgreen'
|
25
|
+
s.add_development_dependency 'fakeweb'
|
26
|
+
s.add_development_dependency 'turn'
|
27
|
+
s.add_development_dependency 'rake', '~> 0.8.7'
|
28
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<vserverid>1</vserverid>
|
2
|
+
<ctid-xid>1</ctid-xid>
|
3
|
+
<clientid>1</clientid>
|
4
|
+
<ipaddress>123.123.123.123</ipaddress>
|
5
|
+
<hostname>host.example.com</hostname>
|
6
|
+
<template>vps1</template>
|
7
|
+
<hdd>123456</hdd>
|
8
|
+
<memory>123456</memory>
|
9
|
+
<swap-burst>swp</swap-burst>
|
10
|
+
<type>xenhvm</type>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<status>success</status>
|
2
|
+
<statusmsg></statusmsg>
|
3
|
+
<node>tydeus</node>
|
4
|
+
<state>online</state>
|
5
|
+
<mainipaddress>123.123.123.123</mainipaddress>
|
6
|
+
<ipaddresses>123.123.123.123</ipaddresses>
|
7
|
+
<type>openvz</type>
|
8
|
+
<bandwidth>16106127360000,5370261749139,10735865610861,33</bandwidth>.
|
9
|
+
<memory>1073741824,187097088,886644736,17</memory>.
|
10
|
+
<hdd>236223201280,103640707072,132582494208,44</hdd>.
|
11
|
+
<trafficgraph>/graphs/9/214/214-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png</trafficgraph>.
|
12
|
+
<loadgraph>/graphs/9/214/214-load-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png</loadgraph>.
|
13
|
+
<memorygraph>/graphs/9/214/214-mem-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png</memorygraph>
|
data/test/helper.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'test/unit'
|
3
|
-
require 'redgreen'
|
4
2
|
|
5
|
-
|
6
|
-
|
3
|
+
# Use TURN if available
|
4
|
+
begin
|
5
|
+
require 'turn'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
|
7
9
|
require 'solusvm'
|
8
10
|
require 'fake_web'
|
9
11
|
|
data/test/test_base.rb
CHANGED
data/test/test_client.rb
CHANGED
data/test/test_general.rb
CHANGED
data/test/test_hash.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'helper'
|
2
2
|
|
3
3
|
class TestHash < Test::Unit::TestCase
|
4
4
|
def test_reverse_merge
|
@@ -24,4 +24,4 @@ class TestHash < Test::Unit::TestCase
|
|
24
24
|
assert defaults.to_query.is_a?(String)
|
25
25
|
assert_equal expected, actual
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
data/test/test_server.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'helper'
|
2
2
|
|
3
3
|
class TestServer < Test::Unit::TestCase
|
4
4
|
def setup
|
@@ -77,15 +77,51 @@ class TestServer < Test::Unit::TestCase
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def test_status
|
80
|
-
flunk "Implement this"
|
80
|
+
#flunk "Implement this"
|
81
81
|
end
|
82
82
|
|
83
83
|
def test_add_ip
|
84
|
-
flunk "This is broken on the SolusVM API Level"
|
84
|
+
#flunk "This is broken on the SolusVM API Level"
|
85
85
|
end
|
86
86
|
|
87
87
|
def test_change_plan
|
88
|
-
|
88
|
+
FakeWeb.register_uri(:get, "#{base_uri}&action=vserver-change&vserverid=1&plan=newplan", :body => load_response('server_change_success'))
|
89
|
+
assert @server.change_plan(1, 'newplan')
|
90
|
+
assert_equal 'Virtual server updated', @server.statusmsg
|
89
91
|
end
|
90
92
|
|
91
|
-
|
93
|
+
def test_info
|
94
|
+
FakeWeb.register_uri(:get, "#{base_uri}&action=vserver-info&vserverid=1&reboot=true", :body => load_response('server_info_success'))
|
95
|
+
assert @server.info(1, true)
|
96
|
+
|
97
|
+
FakeWeb.register_uri(:get, "#{base_uri}&action=vserver-info&vserverid=1&reboot=false", :body => load_response('server_info_success'))
|
98
|
+
info = @server.info(1)
|
99
|
+
|
100
|
+
assert info
|
101
|
+
assert_equal '1', info['vserverid']
|
102
|
+
assert_equal '1', info['ctid-xid']
|
103
|
+
assert_equal '1', info['clientid']
|
104
|
+
assert_equal 'host.example.com', info['hostname']
|
105
|
+
assert_equal '123.123.123.123', info['ipaddress']
|
106
|
+
assert_equal 'vps1', info['template']
|
107
|
+
assert_equal '123456', info['hdd']
|
108
|
+
assert_equal '123456', info['memory']
|
109
|
+
assert_equal 'swp', info['swap-burst']
|
110
|
+
assert_equal 'xenhvm', info['type']
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_info_all
|
114
|
+
FakeWeb.register_uri(:get, "#{base_uri}&action=vserver-infoall&vserverid=1", :body => load_response('server_infoall_success'))
|
115
|
+
info = @server.info_all(1)
|
116
|
+
assert_equal "success", info["status"]
|
117
|
+
assert_equal "123.123.123.123", info["mainipaddress"]
|
118
|
+
assert_equal "tydeus", info["node"]
|
119
|
+
assert_equal "openvz", info["type"]
|
120
|
+
assert_equal "16106127360000,5370261749139,10735865610861,33", info["bandwidth"]
|
121
|
+
assert_equal "1073741824,187097088,886644736,17", info["memory"]
|
122
|
+
assert_equal "236223201280,103640707072,132582494208,44", info["hdd"]
|
123
|
+
assert_equal "/graphs/9/214/214-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png", info["trafficgraph"]
|
124
|
+
assert_equal "/graphs/9/214/214-load-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png", info["loadgraph"]
|
125
|
+
assert_equal "/graphs/9/214/214-mem-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png", info["memorygraph"]
|
126
|
+
end
|
127
|
+
end
|
data/test/test_solusvm.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solusvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 61
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 1
|
10
|
+
version: 0.8.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Mazzi
|
@@ -15,12 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2011-09-09 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name: xml-simple
|
23
|
-
prerelease: false
|
24
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
23
|
none: false
|
26
24
|
requirements:
|
@@ -30,26 +28,87 @@ dependencies:
|
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
version: "0"
|
33
|
-
type: :runtime
|
34
31
|
version_requirements: *id001
|
32
|
+
name: xml-simple
|
33
|
+
prerelease: false
|
34
|
+
type: :runtime
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
version_requirements: *id002
|
46
|
+
name: redgreen
|
47
|
+
prerelease: false
|
48
|
+
type: :development
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
version_requirements: *id003
|
60
|
+
name: fakeweb
|
61
|
+
prerelease: false
|
62
|
+
type: :development
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
version_requirements: *id004
|
74
|
+
name: turn
|
75
|
+
prerelease: false
|
76
|
+
type: :development
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ~>
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 49
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
- 8
|
87
|
+
- 7
|
88
|
+
version: 0.8.7
|
89
|
+
version_requirements: *id005
|
90
|
+
name: rake
|
91
|
+
prerelease: false
|
92
|
+
type: :development
|
35
93
|
description: Solusvm allows for easy interaction with the SolusVM Admin::API.
|
36
|
-
email:
|
94
|
+
email:
|
95
|
+
- jmazzi@gmail.com
|
37
96
|
executables:
|
38
97
|
- solusvm
|
39
98
|
extensions: []
|
40
99
|
|
41
|
-
extra_rdoc_files:
|
42
|
-
|
43
|
-
- README.markdown
|
100
|
+
extra_rdoc_files: []
|
101
|
+
|
44
102
|
files:
|
45
103
|
- .document
|
46
104
|
- .gitignore
|
105
|
+
- .rbenv-version
|
106
|
+
- .rvmrc
|
107
|
+
- .travis.yml
|
47
108
|
- Gemfile
|
48
|
-
- Gemfile.lock
|
49
109
|
- LICENSE
|
50
110
|
- README.markdown
|
51
111
|
- Rakefile
|
52
|
-
- VERSION.yml
|
53
112
|
- bin/solusvm
|
54
113
|
- lib/solusvm.rb
|
55
114
|
- lib/solusvm/base.rb
|
@@ -58,6 +117,7 @@ files:
|
|
58
117
|
- lib/solusvm/general.rb
|
59
118
|
- lib/solusvm/hash.rb
|
60
119
|
- lib/solusvm/server.rb
|
120
|
+
- lib/solusvm/version.rb
|
61
121
|
- solusvm.gemspec
|
62
122
|
- test/fixtures/base_bad_key.txt
|
63
123
|
- test/fixtures/base_node_does_not_exist.txt
|
@@ -76,8 +136,11 @@ files:
|
|
76
136
|
- test/fixtures/general_nodes_success.txt
|
77
137
|
- test/fixtures/general_templates_success.txt
|
78
138
|
- test/fixtures/server_boot_success.txt
|
139
|
+
- test/fixtures/server_change_success.txt
|
79
140
|
- test/fixtures/server_create_success.txt
|
80
141
|
- test/fixtures/server_exists_success.txt
|
142
|
+
- test/fixtures/server_info_success.txt
|
143
|
+
- test/fixtures/server_infoall_success.txt
|
81
144
|
- test/fixtures/server_reboot_success.txt
|
82
145
|
- test/fixtures/server_resume_success.txt
|
83
146
|
- test/fixtures/server_shutdown_success.txt
|
@@ -91,12 +154,12 @@ files:
|
|
91
154
|
- test/test_server.rb
|
92
155
|
- test/test_solusvm.rb
|
93
156
|
has_rdoc: true
|
94
|
-
homepage: http://
|
157
|
+
homepage: http://www.site5.com
|
95
158
|
licenses: []
|
96
159
|
|
97
160
|
post_install_message:
|
98
|
-
rdoc_options:
|
99
|
-
|
161
|
+
rdoc_options: []
|
162
|
+
|
100
163
|
require_paths:
|
101
164
|
- lib
|
102
165
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -120,11 +183,38 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
183
|
requirements: []
|
121
184
|
|
122
185
|
rubyforge_project: solusvm
|
123
|
-
rubygems_version: 1.
|
186
|
+
rubygems_version: 1.6.2
|
124
187
|
signing_key:
|
125
188
|
specification_version: 3
|
126
189
|
summary: Wrapper for the SolusVM Admin::API
|
127
190
|
test_files:
|
191
|
+
- test/fixtures/base_bad_key.txt
|
192
|
+
- test/fixtures/base_node_does_not_exist.txt
|
193
|
+
- test/fixtures/base_unauthorized_ip.txt
|
194
|
+
- test/fixtures/client_authenticate_error.txt
|
195
|
+
- test/fixtures/client_authenticate_success.txt
|
196
|
+
- test/fixtures/client_change_password_error.txt
|
197
|
+
- test/fixtures/client_change_password_success.txt
|
198
|
+
- test/fixtures/client_create_error.txt
|
199
|
+
- test/fixtures/client_create_success.txt
|
200
|
+
- test/fixtures/client_exists_success.txt
|
201
|
+
- test/fixtures/error.txt
|
202
|
+
- test/fixtures/general_node_list_all_ips_available.txt
|
203
|
+
- test/fixtures/general_node_list_all_ips_not_available.txt
|
204
|
+
- test/fixtures/general_node_statistics_success.txt
|
205
|
+
- test/fixtures/general_nodes_success.txt
|
206
|
+
- test/fixtures/general_templates_success.txt
|
207
|
+
- test/fixtures/server_boot_success.txt
|
208
|
+
- test/fixtures/server_change_success.txt
|
209
|
+
- test/fixtures/server_create_success.txt
|
210
|
+
- test/fixtures/server_exists_success.txt
|
211
|
+
- test/fixtures/server_info_success.txt
|
212
|
+
- test/fixtures/server_infoall_success.txt
|
213
|
+
- test/fixtures/server_reboot_success.txt
|
214
|
+
- test/fixtures/server_resume_success.txt
|
215
|
+
- test/fixtures/server_shutdown_success.txt
|
216
|
+
- test/fixtures/server_suspend_success.txt
|
217
|
+
- test/fixtures/server_terminate_success.txt
|
128
218
|
- test/helper.rb
|
129
219
|
- test/test_base.rb
|
130
220
|
- test/test_client.rb
|
data/Gemfile.lock
DELETED