kakin 0.3.1 → 0.4.0

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
  SHA256:
3
- metadata.gz: 3cb8efde1aaf89f79943e1430156764e6e96983cf35f7d6fac5bca89362dccce
4
- data.tar.gz: f8ad30e03dc74e4ad47e7d8f4f423e87ab1ee0d0c8bc08a12fb458697d7df08a
3
+ metadata.gz: c9c6fa53613bd8220fffe498b25b31db2b40d04a1623c2779ad87355e5f8b466
4
+ data.tar.gz: b2a124e6ca09b58c6b59a2ffdd8c5bf1334ec942e8dcd1944a1bb08ea08b093d
5
5
  SHA512:
6
- metadata.gz: '049ad99c0c396f8e80c163c990b5fd75399c80e6736f92fbb8cc6a21e1d359f528fdb3081dc538cf2a71a59293ab73042680a85bf112d3bf5d901b67a24b3e03'
7
- data.tar.gz: 8e7ca17705acfd89b4187e9ec769abb0e49e741bf31b869e19d4eb08652bfe72a8e1e4c243de82f94d686d6e1addb320a21e25e6ac2255f9e4661b828a571b6c
6
+ metadata.gz: c4137646f75989f86fbc65ef8a6b4d48b1d33d9d21abda779d2860dc1693dc8923c158f9ecbdcbdf7f0c74c794e944e410237066371e6e423666a2c4b2d662c3
7
+ data.tar.gz: 2be2fa5bdbaae9f341bb6cf8aff1abc316b6a6a59affecbdd8338b9352ce25b39d5fa12f31beabf0a673cf3e360304b51723e08af6d71b7028886dbedba6edc9
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'thor'
22
22
  spec.add_dependency 'yao'
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "bundler", "~> 2.0.1"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "minitest"
27
27
  end
@@ -3,6 +3,7 @@ require 'yaml'
3
3
  require 'json'
4
4
  require 'net/http'
5
5
  require 'yao'
6
+ require 'kakin/yao_ext/yao'
6
7
  require 'kakin/yao_ext/tenant'
7
8
  require 'kakin/yao_ext/server'
8
9
  require 'kakin/yao_ext/floatingip'
@@ -27,7 +28,6 @@ module Kakin
27
28
  STDERR.puts "Start: #{start_time}"
28
29
  STDERR.puts "End: #{end_time}"
29
30
  client = Yao.default_client.pool['compute']
30
- tenant_id = Yao::Tenant.get_by_name(Kakin::Configuration.tenant).id
31
31
  res = client.get("./os-simple-tenant-usage?start=#{start_time}&end=#{end_time}") do |req|
32
32
  req.headers["Accept"] = "application/json"
33
33
  end
@@ -37,7 +37,7 @@ module Kakin
37
37
  else
38
38
  result = Hash.new
39
39
  tenant_usages = res.body["tenant_usages"]
40
- tenants = Yao::Tenant.list
40
+ tenants = Yao.tenant_klass.list
41
41
 
42
42
  unless options[:t].empty?
43
43
  tenant = tenants.find { |tenant| tenant.name == options[:t] }
@@ -90,9 +90,9 @@ module Kakin
90
90
 
91
91
  result = Hash.new
92
92
  tenants = unless options[:t].empty?
93
- Yao::Tenant.list(name: options[:t])
93
+ Yao.tenant_klass.list(name: options[:t])
94
94
  else
95
- Yao::Tenant.list
95
+ Yao.tenant_klass.list
96
96
  end
97
97
  tenants = [tenants] unless tenants.is_a?(Array)
98
98
 
@@ -120,9 +120,9 @@ module Kakin
120
120
 
121
121
  result = Hash.new
122
122
  tenants = unless options[:t].empty?
123
- Yao::Tenant.list(name: options[:t])
123
+ Yao.tenant_klass.list(name: options[:t])
124
124
  else
125
- Yao::Tenant.list
125
+ Yao.tenant_klass.list
126
126
  end
127
127
  tenants = [tenants] unless tenants.is_a?(Array)
128
128
 
@@ -147,9 +147,9 @@ module Kakin
147
147
 
148
148
  result = Hash.new
149
149
  tenants = unless options[:t].empty?
150
- Yao::Tenant.list(name: options[:t])
150
+ Yao.tenant_klass.list(name: options[:t])
151
151
  else
152
- Yao::Tenant.list
152
+ Yao.tenant_klass.list
153
153
  end
154
154
  tenants = [tenants] unless tenants.is_a?(Array)
155
155
  volume_types = Yao::VolumeType.list
@@ -1,3 +1,3 @@
1
1
  module Kakin
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -0,0 +1,10 @@
1
+ module Yao
2
+ def self.tenant_klass
3
+ Yao.keystone_v2? ? Yao::Tenant : Yao::Project
4
+ end
5
+
6
+ # @return [Bool]
7
+ def self.keystone_v2?
8
+ Yao.default_client.pool["identity"].url_prefix.to_s.match(/v2\.0/)
9
+ end
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kakin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - buty4649
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-02-20 00:00:00.000000000 Z
12
+ date: 2019-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '1.10'
48
+ version: 2.0.1
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '1.10'
55
+ version: 2.0.1
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +107,7 @@ files:
107
107
  - lib/kakin/yao_ext/floatingip.rb
108
108
  - lib/kakin/yao_ext/server.rb
109
109
  - lib/kakin/yao_ext/tenant.rb
110
+ - lib/kakin/yao_ext/yao.rb
110
111
  homepage: https://github.com/yaocloud/kakin
111
112
  licenses: []
112
113
  metadata: {}
@@ -125,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
126
  - !ruby/object:Gem::Version
126
127
  version: '0'
127
128
  requirements: []
128
- rubyforge_project:
129
- rubygems_version: 2.7.6
129
+ rubygems_version: 3.0.3
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: kakin is resource calcuration tool for OpenStack