yao 0.3.1 → 0.3.2
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/.travis.yml +4 -3
- data/README.md +7 -2
- data/lib/yao/auth.rb +1 -1
- data/lib/yao/client.rb +9 -0
- data/lib/yao/version.rb +1 -1
- data/test/fixtures/dummy.key +1 -0
- data/test/fixtures/dummy.pem +1 -0
- data/test/yao/test_client.rb +12 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f5e910f9f7616e6e9e7402416b818e366d718e1
|
4
|
+
data.tar.gz: 392f0c4b9ba85c8c5fed0939c3dc07c457611a3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9432f815b9ec8e394f85764827537d2dcdc646823201f2cba83cd3b830177ce59f738675c61b4bcd18603e61b934ba31d46400c27f29b3abf022566d536c533d
|
7
|
+
data.tar.gz: 9d035450f40b5672afdffc7c8e43d0f8567ae47ddabcf3db0d6534da324b5987288bf53adc5bdd4b889e7e2c0cbc99b17be0c27492069117304a649c5b17a4b8
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -30,6 +30,13 @@ Yao.configure do
|
|
30
30
|
tenant_name "fooproject"
|
31
31
|
username "udzura"
|
32
32
|
password "tonk0tsu-r@men"
|
33
|
+
|
34
|
+
# timeout is optional
|
35
|
+
timeout 300
|
36
|
+
|
37
|
+
# If your endpoint requires cert & key
|
38
|
+
client_cert "/path/to/my.pem"
|
39
|
+
client_key "/path/to/my.key"
|
33
40
|
end
|
34
41
|
|
35
42
|
Yao::Network.list # list up networks...
|
@@ -67,8 +74,6 @@ OpenStack.configure do
|
|
67
74
|
tenant_name "fooproject"
|
68
75
|
username "udzura"
|
69
76
|
password "tonk0tsu-r@men"
|
70
|
-
# timeout is optional
|
71
|
-
timeout 300
|
72
77
|
end
|
73
78
|
|
74
79
|
OpenStack::Server.list_detail # And let's go on
|
data/lib/yao/auth.rb
CHANGED
data/lib/yao/client.rb
CHANGED
@@ -65,6 +65,15 @@ module Yao
|
|
65
65
|
def client_options
|
66
66
|
opt = {}
|
67
67
|
opt.merge!({ request: { timeout: Yao.config.timeout }}) if Yao.config.timeout
|
68
|
+
if Yao.config.client_cert && Yao.config.client_key
|
69
|
+
require 'openssl'
|
70
|
+
cert = OpenSSL::X509::Certificate.new(File.read(Yao.config.client_cert))
|
71
|
+
key = OpenSSL::PKey.read(File.read(Yao.config.client_key))
|
72
|
+
opt.merge!(ssl: {
|
73
|
+
client_cert: cert,
|
74
|
+
client_key: key,
|
75
|
+
})
|
76
|
+
end
|
68
77
|
opt
|
69
78
|
end
|
70
79
|
end
|
data/lib/yao/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
"OK"
|
@@ -0,0 +1 @@
|
|
1
|
+
"OK"
|
data/test/yao/test_client.rb
CHANGED
@@ -55,4 +55,16 @@ class TestClient < Test::Unit::TestCase
|
|
55
55
|
cli = Yao::Client.gen_client("http://cool-api.example.com:12345/v3.0")
|
56
56
|
assert { cli.options.timeout == 300 }
|
57
57
|
end
|
58
|
+
|
59
|
+
def test_cert_key
|
60
|
+
stub(Yao.config).client_cert { File.expand_path("../../fixtures/dummy.pem", __FILE__) }
|
61
|
+
stub(Yao.config).client_key { File.expand_path("../../fixtures/dummy.key", __FILE__) }
|
62
|
+
stub(OpenSSL::X509::Certificate).new { "DummyCert" }
|
63
|
+
stub(OpenSSL::PKey).read { "DummyKey" }
|
64
|
+
|
65
|
+
cli = Yao::Client.gen_client("http://cool-api.example.com:12345/v3.0")
|
66
|
+
ssl = cli.ssl
|
67
|
+
assert { ssl[:client_cert] == "DummyCert" }
|
68
|
+
assert { ssl[:client_key] == "DummyKey" }
|
69
|
+
end
|
58
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uchio, KONDO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -205,6 +205,8 @@ files:
|
|
205
205
|
- lib/yao/token.rb
|
206
206
|
- lib/yao/version.rb
|
207
207
|
- test/config.rb
|
208
|
+
- test/fixtures/dummy.key
|
209
|
+
- test/fixtures/dummy.pem
|
208
210
|
- test/support/auth_stub.rb
|
209
211
|
- test/yao/resources/test_role.rb
|
210
212
|
- test/yao/resources/test_security_group.rb
|
@@ -245,6 +247,8 @@ specification_version: 4
|
|
245
247
|
summary: Yet Another OpenStack API Wrapper that rocks!!
|
246
248
|
test_files:
|
247
249
|
- test/config.rb
|
250
|
+
- test/fixtures/dummy.key
|
251
|
+
- test/fixtures/dummy.pem
|
248
252
|
- test/support/auth_stub.rb
|
249
253
|
- test/yao/resources/test_role.rb
|
250
254
|
- test/yao/resources/test_security_group.rb
|