yao 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd6c10a9f17a721d151c633f1668bc518c01fb51
4
- data.tar.gz: e520c0d5a5a3eff1dfbd796c883af865747f0882
3
+ metadata.gz: 5f5e910f9f7616e6e9e7402416b818e366d718e1
4
+ data.tar.gz: 392f0c4b9ba85c8c5fed0939c3dc07c457611a3e
5
5
  SHA512:
6
- metadata.gz: eff49cbc10c33dffc702372092d7af9196a9dda99af850f61531e592a3b1ffaa0601cfedcdd0872a98e35b70a1a38226f3cbf3fc852c6db192933f5546317c03
7
- data.tar.gz: dac64ca02915c373496db975899f53e44b3b489f81f558207449796d9644cc51c29ceeee0dba4cee5e1141514c4b04dc5e0137c53c00fccb8e0aa0f24a749f39
6
+ metadata.gz: 9432f815b9ec8e394f85764827537d2dcdc646823201f2cba83cd3b830177ce59f738675c61b4bcd18603e61b934ba31d46400c27f29b3abf022566d536c533d
7
+ data.tar.gz: 9d035450f40b5672afdffc7c8e43d0f8567ae47ddabcf3db0d6534da324b5987288bf53adc5bdd4b889e7e2c0cbc99b17be0c27492069117304a649c5b17a4b8
data/.travis.yml CHANGED
@@ -1,9 +1,10 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.1.7
5
- - 2.2.3
6
- - 2.3.0-preview1
4
+ - 2.2.7
5
+ - 2.3.4
6
+ - 2.4.1
7
+ - ruby-head
7
8
 
8
9
  install: bundle install --path vendor/bundle
9
10
 
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
@@ -4,7 +4,7 @@ require 'time'
4
4
  require 'yao/token'
5
5
 
6
6
  module Yao
7
- %i(tenant_name username password timeout).each do |name|
7
+ %i(tenant_name username password timeout client_cert client_key).each do |name|
8
8
  Yao.config.param name, nil
9
9
  end
10
10
 
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
@@ -1,3 +1,3 @@
1
1
  module Yao
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -0,0 +1 @@
1
+ "OK"
@@ -0,0 +1 @@
1
+ "OK"
@@ -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.1
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-04-11 00:00:00.000000000 Z
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