opennebula 4.9.80.beta → 4.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opennebula.rb +1 -1
- data/lib/opennebula/client.rb +37 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82ab43ef0a7087ed43b6c4d8ffe865a2a2ceacbd
|
4
|
+
data.tar.gz: 78dba1712d3497bc69c477d9148d30682267f408
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d577db87ccac6fbbfe545d812599feaf9dee940f1881085640b9cbbab211095cf52762a554cd3d27640dc8bfb31632f5ed2f21a32fbb1da0154c0f8698882fed
|
7
|
+
data.tar.gz: 5a4e4f547a0c25213ac3d0af35d4aa6ab3540b71e0ac37f3ca5879c79ccff99771f657fddbad6425f1e745990e26683c1989edded4215385eac371bc82402f93
|
data/lib/opennebula.rb
CHANGED
data/lib/opennebula/client.rb
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
require 'xmlrpc/client'
|
18
18
|
require 'bigdecimal'
|
19
19
|
require 'stringio'
|
20
|
+
require 'openssl'
|
20
21
|
|
21
22
|
|
22
23
|
module OpenNebula
|
@@ -105,6 +106,14 @@ module OpenNebula
|
|
105
106
|
# defaults to 30
|
106
107
|
# @option params [String] :http_proxy HTTP proxy string used for
|
107
108
|
# connecting to the endpoint; defaults to no proxy
|
109
|
+
# @option params [Boolean] :sync Use only one http connection for
|
110
|
+
# all calls. It should not be used for multithreaded programs.
|
111
|
+
# It's the only mode that can be used with :cert_dir and
|
112
|
+
# :disable_ssl_verify
|
113
|
+
# @option params [String] :cert_dir Extra directory where to import
|
114
|
+
# trusted issuer certificates. Use with :sync = true
|
115
|
+
# @option params [String] :disable_ssl_verify Disable SSL certificate
|
116
|
+
# verification. Use only for testing and with :sync = true
|
108
117
|
#
|
109
118
|
# @return [OpenNebula::Client]
|
110
119
|
def initialize(secret=nil, endpoint=nil, options={})
|
@@ -135,6 +144,8 @@ module OpenNebula
|
|
135
144
|
@one_endpoint = "http://localhost:2633/RPC2"
|
136
145
|
end
|
137
146
|
|
147
|
+
@async = !options[:sync]
|
148
|
+
|
138
149
|
timeout=nil
|
139
150
|
timeout=options[:timeout] if options[:timeout]
|
140
151
|
|
@@ -144,6 +155,27 @@ module OpenNebula
|
|
144
155
|
@server = XMLRPC::Client.new2(@one_endpoint, http_proxy, timeout)
|
145
156
|
@server.http_header_extra = {'accept-encoding' => 'identity'}
|
146
157
|
|
158
|
+
http = @server.instance_variable_get("@http")
|
159
|
+
|
160
|
+
if options[:cert_dir] || ENV['ONE_CERT_DIR']
|
161
|
+
raise "SSL options don't work in async mode" if @async
|
162
|
+
|
163
|
+
cert_dir = options[:cert_dir] || ENV['ONE_CERT_DIR']
|
164
|
+
cert_files = Dir["#{cert_dir}/*"]
|
165
|
+
|
166
|
+
cert_store = OpenSSL::X509::Store.new
|
167
|
+
cert_store.set_default_paths
|
168
|
+
cert_files.each {|cert| cert_store.add_file(cert) }
|
169
|
+
|
170
|
+
http.cert_store = cert_store
|
171
|
+
end
|
172
|
+
|
173
|
+
if options[:disable_ssl_verify] || ENV['ONE_DISABLE_SSL_VERIFY']
|
174
|
+
raise "SSL options don't work in async mode" if @async
|
175
|
+
|
176
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
177
|
+
end
|
178
|
+
|
147
179
|
if defined?(OxStreamParser)
|
148
180
|
@server.set_parser(OxStreamParser.new)
|
149
181
|
elsif OpenNebula::NOKOGIRI
|
@@ -155,7 +187,11 @@ module OpenNebula
|
|
155
187
|
|
156
188
|
def call(action, *args)
|
157
189
|
begin
|
158
|
-
|
190
|
+
if @async
|
191
|
+
response = @server.call_async("one."+action, @one_auth, *args)
|
192
|
+
else
|
193
|
+
response = @server.call("one."+action, @one_auth, *args)
|
194
|
+
end
|
159
195
|
|
160
196
|
if response[0] == false
|
161
197
|
Error.new(response[1], response[2])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opennebula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -89,7 +89,8 @@ files:
|
|
89
89
|
- lib/opennebula/zone.rb
|
90
90
|
- lib/opennebula/zone_pool.rb
|
91
91
|
homepage: http://opennebula.org
|
92
|
-
licenses:
|
92
|
+
licenses:
|
93
|
+
- Apache-2.0
|
93
94
|
metadata: {}
|
94
95
|
post_install_message:
|
95
96
|
rdoc_options: []
|
@@ -102,9 +103,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
103
|
version: '0'
|
103
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
105
|
requirements:
|
105
|
-
- - "
|
106
|
+
- - ">="
|
106
107
|
- !ruby/object:Gem::Version
|
107
|
-
version:
|
108
|
+
version: '0'
|
108
109
|
requirements: []
|
109
110
|
rubyforge_project:
|
110
111
|
rubygems_version: 2.2.2
|