misty 1.4.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +87 -88
  3. data/lib/misty.rb +115 -1
  4. data/lib/misty/auth/catalog.rb +38 -0
  5. data/lib/misty/auth/catalog/v2.rb +15 -0
  6. data/lib/misty/auth/catalog/v3.rb +15 -0
  7. data/lib/misty/auth/token.rb +70 -0
  8. data/lib/misty/auth/token/v2.rb +63 -0
  9. data/lib/misty/auth/token/v3.rb +90 -0
  10. data/lib/misty/cloud.rb +74 -15
  11. data/lib/misty/config.rb +37 -43
  12. data/lib/misty/errors.rb +25 -5
  13. data/lib/misty/helper.rb +26 -0
  14. data/lib/misty/http/header.rb +3 -6
  15. data/lib/misty/http/method_builder.rb +2 -2
  16. data/lib/misty/http/request.rb +3 -3
  17. data/lib/misty/microversion.rb +12 -1
  18. data/lib/misty/misty.rb +7 -62
  19. data/lib/misty/openstack.rb +39 -0
  20. data/lib/misty/openstack/{aodh → api/aodh}/aodh_v2.rb +1 -1
  21. data/lib/misty/openstack/api/aodh/v2.rb +19 -0
  22. data/lib/misty/openstack/api/barbican/barbican_v1.rb +42 -0
  23. data/lib/misty/openstack/api/barbican/v1.rb +19 -0
  24. data/lib/misty/openstack/api/blazar/blazar_v1.rb +16 -0
  25. data/lib/misty/openstack/api/blazar/v1.rb +19 -0
  26. data/lib/misty/openstack/{ceilometer → api/ceilometer}/ceilometer_v2.rb +1 -1
  27. data/lib/misty/openstack/api/ceilometer/v2.rb +19 -0
  28. data/lib/misty/openstack/{cinder → api/cinder}/cinder_v1.rb +1 -1
  29. data/lib/misty/openstack/{cinder → api/cinder}/cinder_v2.rb +3 -3
  30. data/lib/misty/openstack/{cinder → api/cinder}/cinder_v3.rb +7 -4
  31. data/lib/misty/openstack/api/cinder/v1.rb +23 -0
  32. data/lib/misty/openstack/api/cinder/v2.rb +24 -0
  33. data/lib/misty/openstack/api/cinder/v3.rb +29 -0
  34. data/lib/misty/openstack/{designate → api/designate}/designate_v2.rb +2 -2
  35. data/lib/misty/openstack/api/designate/v2.rb +19 -0
  36. data/lib/misty/openstack/{freezer → api/freezer}/freezer_v1.rb +2 -2
  37. data/lib/misty/openstack/api/freezer/v1.rb +19 -0
  38. data/lib/misty/openstack/{glance → api/glance}/glance_v1.rb +1 -1
  39. data/lib/misty/openstack/{glance → api/glance}/glance_v2.rb +1 -1
  40. data/lib/misty/openstack/api/glance/v1.rb +19 -0
  41. data/lib/misty/openstack/api/glance/v2.rb +24 -0
  42. data/lib/misty/openstack/api/gnocchi/gnocchi_v1.rb +39 -0
  43. data/lib/misty/openstack/api/gnocchi/v1.rb +19 -0
  44. data/lib/misty/openstack/{heat → api/heat}/heat_v1.rb +1 -1
  45. data/lib/misty/openstack/api/heat/v1.rb +23 -0
  46. data/lib/misty/openstack/{ironic → api/ironic}/ironic_v1.rb +8 -2
  47. data/lib/misty/openstack/api/ironic/v1.rb +25 -0
  48. data/lib/misty/openstack/{karbor → api/karbor}/karbor_v1.rb +2 -2
  49. data/lib/misty/openstack/api/karbor/v1.rb +19 -0
  50. data/lib/misty/openstack/{keystone → api/keystone}/keystone_v2_0.rb +1 -1
  51. data/lib/misty/openstack/api/keystone/keystone_v2_0_ext.rb +14 -0
  52. data/lib/misty/openstack/{keystone → api/keystone}/keystone_v3.rb +35 -3
  53. data/lib/misty/openstack/{keystone → api/keystone}/keystone_v3_ext.rb +7 -9
  54. data/lib/misty/openstack/api/keystone/v2_0.rb +23 -0
  55. data/lib/misty/openstack/api/keystone/v3.rb +23 -0
  56. data/lib/misty/openstack/{magnum → api/magnum}/magnum_v1.rb +2 -2
  57. data/lib/misty/openstack/api/magnum/v1.rb +21 -0
  58. data/lib/misty/openstack/{manila → api/manila}/manila_v2.rb +7 -3
  59. data/lib/misty/openstack/api/manila/v2.rb +25 -0
  60. data/lib/misty/openstack/api/masakari/masakari_v1_0.rb +22 -0
  61. data/lib/misty/openstack/api/masakari/v1_0.rb +19 -0
  62. data/lib/misty/openstack/api/mistral/mistral_v2.rb +44 -0
  63. data/lib/misty/openstack/api/mistral/v2.rb +19 -0
  64. data/lib/misty/openstack/api/monasca/monasca_v2_0.rb +28 -0
  65. data/lib/misty/openstack/api/monasca/v2_0.rb +19 -0
  66. data/lib/misty/openstack/{murano → api/murano}/murano_v1.rb +1 -1
  67. data/lib/misty/openstack/api/murano/v1.rb +19 -0
  68. data/lib/misty/openstack/{neutron → api/neutron}/neutron_v2_0.rb +11 -12
  69. data/lib/misty/openstack/api/neutron/v2_0.rb +19 -0
  70. data/lib/misty/openstack/{nova → api/nova}/nova_v2_1.rb +1 -2
  71. data/lib/misty/openstack/api/nova/v2_1.rb +33 -0
  72. data/lib/misty/openstack/{octavia → api/octavia}/octavia_v2_0.rb +4 -3
  73. data/lib/misty/openstack/api/octavia/v2_0.rb +19 -0
  74. data/lib/misty/openstack/api/panko/panko_v2.rb +14 -0
  75. data/lib/misty/openstack/api/panko/v2.rb +19 -0
  76. data/lib/misty/openstack/api/placement/placement_v2_1.rb +50 -0
  77. data/lib/misty/openstack/api/placement/v2_1.rb +21 -0
  78. data/lib/misty/openstack/{sahara → api/sahara}/sahara_v1_1.rb +2 -2
  79. data/lib/misty/openstack/api/sahara/v1_1.rb +19 -0
  80. data/lib/misty/openstack/{searchlight → api/searchlight}/searchlight_v1.rb +2 -2
  81. data/lib/misty/openstack/api/searchlight/v1.rb +19 -0
  82. data/lib/misty/openstack/{senlin → api/senlin}/senlin_v1.rb +2 -2
  83. data/lib/misty/openstack/api/senlin/v1.rb +19 -0
  84. data/lib/misty/openstack/{swift → api/swift}/swift_v1.rb +2 -2
  85. data/lib/misty/openstack/api/swift/v1.rb +34 -0
  86. data/lib/misty/openstack/{tacker → api/tacker}/tacker_v1_0.rb +2 -2
  87. data/lib/misty/openstack/api/tacker/v1_0.rb +19 -0
  88. data/lib/misty/openstack/{trove → api/trove}/trove_v1_0.rb +23 -8
  89. data/lib/misty/openstack/api/trove/v1_0.rb +19 -0
  90. data/lib/misty/openstack/api/watcher/v1.rb +19 -0
  91. data/lib/misty/openstack/api/watcher/watcher_v1.rb +38 -0
  92. data/lib/misty/openstack/api/zaqar/v2.rb +19 -0
  93. data/lib/misty/openstack/{zaqar → api/zaqar}/zaqar_v2.rb +2 -2
  94. data/lib/misty/openstack/api/zun/v1.rb +19 -0
  95. data/lib/misty/openstack/api/zun/zun_v1.rb +55 -0
  96. data/lib/misty/openstack/service.rb +18 -15
  97. data/lib/misty/openstack/service_pack.rb +18 -0
  98. data/lib/misty/service.rb +4 -6
  99. data/lib/misty/services.rb +11 -10
  100. data/lib/misty/version.rb +1 -1
  101. data/test/integration/compute_test.rb +2 -2
  102. data/test/integration/{networking_test.rb → network_test.rb} +10 -10
  103. data/test/integration/orchestration_test.rb +4 -4
  104. data/test/integration/vcr/{networking_using_neutron_v2_0.yml → network_using_neutron_v2_0.yml} +0 -0
  105. data/test/unit/auth/catalog_test.rb +99 -0
  106. data/test/unit/{auth_test.rb → auth/token_test.rb} +79 -45
  107. data/test/unit/cloud/config_test.rb +79 -41
  108. data/test/unit/cloud/requests_test.rb +6 -6
  109. data/test/unit/cloud/services_test.rb +23 -23
  110. data/test/unit/cloud_test.rb +10 -10
  111. data/test/unit/http/method_builder_test.rb +13 -23
  112. data/test/unit/http/request_test.rb +1 -1
  113. data/test/unit/microversion_test.rb +13 -16
  114. data/test/unit/misty_test.rb +51 -49
  115. data/test/unit/openstack/APIs_test.rb +5 -9
  116. data/test/unit/openstack/extension_test.rb +6 -6
  117. data/test/unit/openstack/service_test.rb +2 -10
  118. data/test/unit/service_helper.rb +3 -8
  119. data/test/unit/services_test.rb +5 -5
  120. metadata +91 -66
  121. data/lib/misty/auth.rb +0 -91
  122. data/lib/misty/auth/auth_v2.rb +0 -65
  123. data/lib/misty/auth/auth_v3.rb +0 -89
  124. data/lib/misty/autoload.rb +0 -99
  125. data/lib/misty/client_pack.rb +0 -16
  126. data/lib/misty/openstack/aodh/v2.rb +0 -17
  127. data/lib/misty/openstack/ceilometer/v2.rb +0 -17
  128. data/lib/misty/openstack/cinder/v1.rb +0 -21
  129. data/lib/misty/openstack/cinder/v2.rb +0 -22
  130. data/lib/misty/openstack/cinder/v3.rb +0 -31
  131. data/lib/misty/openstack/designate/v2.rb +0 -17
  132. data/lib/misty/openstack/freezer/v1.rb +0 -17
  133. data/lib/misty/openstack/glance/v1.rb +0 -17
  134. data/lib/misty/openstack/glance/v2.rb +0 -17
  135. data/lib/misty/openstack/heat/v1.rb +0 -21
  136. data/lib/misty/openstack/ironic/v1.rb +0 -27
  137. data/lib/misty/openstack/karbor/v1.rb +0 -17
  138. data/lib/misty/openstack/keystone/keystone_v2_0_ext.rb +0 -18
  139. data/lib/misty/openstack/keystone/v2_0.rb +0 -21
  140. data/lib/misty/openstack/keystone/v3.rb +0 -21
  141. data/lib/misty/openstack/magnum/v1.rb +0 -23
  142. data/lib/misty/openstack/manila/v2.rb +0 -27
  143. data/lib/misty/openstack/murano/v1.rb +0 -17
  144. data/lib/misty/openstack/neutron/v2_0.rb +0 -17
  145. data/lib/misty/openstack/nova/v2_1.rb +0 -42
  146. data/lib/misty/openstack/octavia/v2_0.rb +0 -17
  147. data/lib/misty/openstack/sahara/v1_1.rb +0 -17
  148. data/lib/misty/openstack/searchlight/v1.rb +0 -17
  149. data/lib/misty/openstack/senlin/v1.rb +0 -17
  150. data/lib/misty/openstack/swift/v1.rb +0 -32
  151. data/lib/misty/openstack/tacker/v1_0.rb +0 -17
  152. data/lib/misty/openstack/trove/v1_0.rb +0 -17
  153. data/lib/misty/openstack/zaqar/v2.rb +0 -17
@@ -21,8 +21,8 @@ end
21
21
 
22
22
  def api_validate(project, version)
23
23
  it "#{project} #{version} loads a valid api structure" do
24
- require "misty/openstack/#{project}/#{project}_#{Misty::Cloud.dot_to_underscore(version)}"
25
- klass = Object.const_get("Misty::Openstack::#{project.capitalize}#{Misty::Cloud.dot_to_underscore(version).capitalize}")
24
+ require "misty/openstack/api/#{project}/#{project}_#{Misty::Cloud.dot_to_underscore(version)}"
25
+ klass = Object.const_get("Misty::Openstack::API::#{project.capitalize}#{Misty::Cloud.dot_to_underscore(version).capitalize}")
26
26
  client = Object.new
27
27
  client.extend(klass)
28
28
  client.tag.must_match /API/
@@ -30,15 +30,11 @@ def api_validate(project, version)
30
30
  end
31
31
  end
32
32
 
33
- # Assert each version of OpenStack project loads a valid api structure
33
+ # Assert each version of OpenStack project loads a valid api structure
34
34
  describe 'Openstack API' do
35
35
  Misty.services.each do |service|
36
- if service.versions
37
- service.versions.each do |version|
38
- api_validate(service.project, version)
39
- end
40
- elsif service.microversion && !service.microversion.empty?
41
- api_validate(service.project, service.microversion)
36
+ service.versions.each do |version|
37
+ api_validate(service.project, version)
42
38
  end
43
39
  end
44
40
  end
@@ -38,22 +38,22 @@ describe Misty::Openstack::Extension do
38
38
  v1
39
39
  end
40
40
 
41
- describe "Succesful" do
42
- it "Adds methods to existing Verb" do
41
+ describe "succesful" do
42
+ it "adds methods to existing Verb" do
43
43
  v1.api["/v1/resource1"][:POST].must_include :method11
44
44
  end
45
45
 
46
- it "Adds Verb" do
46
+ it "adds Verb" do
47
47
  v1.api["/v1/resource1"].must_include :PUT
48
48
  end
49
49
 
50
- it "Adds Resource" do
50
+ it "adds Resource" do
51
51
  v1.api.must_include "/v1/resource3"
52
52
  end
53
53
  end
54
54
 
55
- describe "Fails" do
56
- it "Raise RuntimeError when a resource already exist" do
55
+ describe "fails" do
56
+ it "raise error when a resource already exists" do
57
57
  class << v1
58
58
  def api_ext
59
59
  { "/v1/resource1" => { :POST => [:method1] } }
@@ -15,10 +15,8 @@ describe Misty::Openstack::Service do
15
15
  end
16
16
 
17
17
  it "returns String when defined in API's module" do
18
- class << service
19
- def prefix_path_to_ignore
20
- '/v3/{tenant_id}'
21
- end
18
+ def service.prefix_path_to_ignore
19
+ '/v3/{tenant_id}'
22
20
  end
23
21
 
24
22
  service.prefix_path_to_ignore.must_equal '/v3/{tenant_id}'
@@ -33,12 +31,6 @@ describe Misty::Openstack::Service do
33
31
  end
34
32
  end
35
33
 
36
- describe '#baseclass' do
37
- it 'returns base class name' do
38
- service.send(:baseclass).must_equal 'V2_0'
39
- end
40
- end
41
-
42
34
  describe 'headers' do
43
35
  it 'returns default global along with token' do
44
36
  service.headers.get.must_equal ({"Accept"=>"application/json; q=1.0"})
@@ -1,4 +1,4 @@
1
- require 'misty/client_pack'
1
+ require 'misty/openstack/service_pack'
2
2
  require 'auth_helper'
3
3
 
4
4
  def request_header
@@ -21,14 +21,9 @@ def service(param_content_type = :hash, params = {})
21
21
  stub_request(:post, "http://localhost:5000/v3/auth/tokens").
22
22
  with(:body => "{\"auth\":{\"identity\":{\"methods\":[\"password\"],\"password\":{\"user\":{\"id\":\"user_id\",\"password\":\"secret\"}}},\"scope\":{\"project\":{\"id\":\"project_id\"}}}}",
23
23
  :headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}).
24
- to_return(:status => 200, :body => JSON.dump(auth_response_v3('networking', 'neutron')), :headers => {'x-subject-token'=>'token_data'})
24
+ to_return(:status => 200, :body => JSON.dump(auth_response_v3('network', 'neutron')), :headers => {'x-subject-token'=>'token_data'})
25
25
 
26
26
  config = Misty::Config.new(arg)
27
27
 
28
- # TODO: remove
29
- # stub_request(:post, 'http://localhost:5000/v3/auth/tokens').
30
- # with(:body => "{\"auth\":{\"identity\":{\"methods\":[\"password\"],\"password\":{\"user\":{\"id\":\"user_id\",\"password\":\"secret\"}}},\"scope\":{\"project\":{\"id\":\"project_id\"}}}}").
31
- # to_return(:status => 200, :body => JSON.dump(auth_response_v3('identity', 'keystone')), :headers => {'x-subject-token'=>'token_data'})
32
-
33
- Misty::Openstack::Neutron::V2_0.new(config.get_service(:networking))
28
+ Misty::Openstack::API::Neutron::V2_0.new(config.get_service(:network))
34
29
  end
@@ -4,17 +4,17 @@ describe 'Services' do
4
4
  describe '#add' do
5
5
  it 'Adds a service' do
6
6
  services = Misty::Services.new
7
- services.add(name: :service_name, project: :project_name, versions: ['v1', 'v2.0'], microversion: 'v3')
7
+ services.add(type: :service_type, project: :project_name, versions: ['v1', 'v2.0'], microversion: 'v2.12')
8
8
  service = services.services[0]
9
9
 
10
10
  services.services.size.must_equal 1
11
11
  service.must_be_kind_of Misty::Service
12
- service.name.must_equal :service_name
12
+ service.type.must_equal :service_type
13
13
  service.project.must_equal :project_name
14
14
  service.versions.must_include 'v1'
15
- service.microversion.must_equal 'v3'
16
- service.default_version.must_equal 'v3'
17
- services.to_s.must_equal %Q{service_name: project_name, versions: ["v1", "v2.0"], microversion: v3\n}
15
+ service.microversion.must_equal 'v2.12'
16
+ service.default_version.must_equal 'v2.0'
17
+ services.to_s.must_equal %Q(service_type: project_name, versions: ["v1", "v2.0"], microversion: v2.12\n)
18
18
  end
19
19
  end
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: misty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilles Dubreuil
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-07 00:00:00.000000000 Z
11
+ date: 2018-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -140,15 +140,17 @@ files:
140
140
  - LICENSE.md
141
141
  - README.md
142
142
  - lib/misty.rb
143
- - lib/misty/auth.rb
144
- - lib/misty/auth/auth_v2.rb
145
- - lib/misty/auth/auth_v3.rb
143
+ - lib/misty/auth/catalog.rb
144
+ - lib/misty/auth/catalog/v2.rb
145
+ - lib/misty/auth/catalog/v3.rb
146
146
  - lib/misty/auth/name.rb
147
- - lib/misty/autoload.rb
148
- - lib/misty/client_pack.rb
147
+ - lib/misty/auth/token.rb
148
+ - lib/misty/auth/token/v2.rb
149
+ - lib/misty/auth/token/v3.rb
149
150
  - lib/misty/cloud.rb
150
151
  - lib/misty/config.rb
151
152
  - lib/misty/errors.rb
153
+ - lib/misty/helper.rb
152
154
  - lib/misty/http/direct.rb
153
155
  - lib/misty/http/header.rb
154
156
  - lib/misty/http/method_builder.rb
@@ -156,77 +158,100 @@ files:
156
158
  - lib/misty/http/request.rb
157
159
  - lib/misty/microversion.rb
158
160
  - lib/misty/misty.rb
159
- - lib/misty/openstack/aodh/aodh_v2.rb
160
- - lib/misty/openstack/aodh/v2.rb
161
- - lib/misty/openstack/ceilometer/ceilometer_v2.rb
162
- - lib/misty/openstack/ceilometer/v2.rb
163
- - lib/misty/openstack/cinder/cinder_v1.rb
164
- - lib/misty/openstack/cinder/cinder_v2.rb
165
- - lib/misty/openstack/cinder/cinder_v3.rb
166
- - lib/misty/openstack/cinder/v1.rb
167
- - lib/misty/openstack/cinder/v2.rb
168
- - lib/misty/openstack/cinder/v3.rb
169
- - lib/misty/openstack/designate/designate_v2.rb
170
- - lib/misty/openstack/designate/v2.rb
161
+ - lib/misty/openstack.rb
162
+ - lib/misty/openstack/api/aodh/aodh_v2.rb
163
+ - lib/misty/openstack/api/aodh/v2.rb
164
+ - lib/misty/openstack/api/barbican/barbican_v1.rb
165
+ - lib/misty/openstack/api/barbican/v1.rb
166
+ - lib/misty/openstack/api/blazar/blazar_v1.rb
167
+ - lib/misty/openstack/api/blazar/v1.rb
168
+ - lib/misty/openstack/api/ceilometer/ceilometer_v2.rb
169
+ - lib/misty/openstack/api/ceilometer/v2.rb
170
+ - lib/misty/openstack/api/cinder/cinder_v1.rb
171
+ - lib/misty/openstack/api/cinder/cinder_v2.rb
172
+ - lib/misty/openstack/api/cinder/cinder_v3.rb
173
+ - lib/misty/openstack/api/cinder/v1.rb
174
+ - lib/misty/openstack/api/cinder/v2.rb
175
+ - lib/misty/openstack/api/cinder/v3.rb
176
+ - lib/misty/openstack/api/designate/designate_v2.rb
177
+ - lib/misty/openstack/api/designate/v2.rb
178
+ - lib/misty/openstack/api/freezer/freezer_v1.rb
179
+ - lib/misty/openstack/api/freezer/v1.rb
180
+ - lib/misty/openstack/api/glance/glance_v1.rb
181
+ - lib/misty/openstack/api/glance/glance_v2.rb
182
+ - lib/misty/openstack/api/glance/v1.rb
183
+ - lib/misty/openstack/api/glance/v2.rb
184
+ - lib/misty/openstack/api/gnocchi/gnocchi_v1.rb
185
+ - lib/misty/openstack/api/gnocchi/v1.rb
186
+ - lib/misty/openstack/api/heat/heat_v1.rb
187
+ - lib/misty/openstack/api/heat/v1.rb
188
+ - lib/misty/openstack/api/ironic/ironic_v1.rb
189
+ - lib/misty/openstack/api/ironic/v1.rb
190
+ - lib/misty/openstack/api/karbor/karbor_v1.rb
191
+ - lib/misty/openstack/api/karbor/v1.rb
192
+ - lib/misty/openstack/api/keystone/keystone_v2_0.rb
193
+ - lib/misty/openstack/api/keystone/keystone_v2_0_ext.rb
194
+ - lib/misty/openstack/api/keystone/keystone_v3.rb
195
+ - lib/misty/openstack/api/keystone/keystone_v3_ext.rb
196
+ - lib/misty/openstack/api/keystone/v2_0.rb
197
+ - lib/misty/openstack/api/keystone/v3.rb
198
+ - lib/misty/openstack/api/magnum/magnum_v1.rb
199
+ - lib/misty/openstack/api/magnum/v1.rb
200
+ - lib/misty/openstack/api/manila/manila_v2.rb
201
+ - lib/misty/openstack/api/manila/v2.rb
202
+ - lib/misty/openstack/api/masakari/masakari_v1_0.rb
203
+ - lib/misty/openstack/api/masakari/v1_0.rb
204
+ - lib/misty/openstack/api/mistral/mistral_v2.rb
205
+ - lib/misty/openstack/api/mistral/v2.rb
206
+ - lib/misty/openstack/api/monasca/monasca_v2_0.rb
207
+ - lib/misty/openstack/api/monasca/v2_0.rb
208
+ - lib/misty/openstack/api/murano/murano_v1.rb
209
+ - lib/misty/openstack/api/murano/v1.rb
210
+ - lib/misty/openstack/api/neutron/neutron_v2_0.rb
211
+ - lib/misty/openstack/api/neutron/v2_0.rb
212
+ - lib/misty/openstack/api/nova/nova_v2_1.rb
213
+ - lib/misty/openstack/api/nova/v2_1.rb
214
+ - lib/misty/openstack/api/octavia/octavia_v2_0.rb
215
+ - lib/misty/openstack/api/octavia/v2_0.rb
216
+ - lib/misty/openstack/api/panko/panko_v2.rb
217
+ - lib/misty/openstack/api/panko/v2.rb
218
+ - lib/misty/openstack/api/placement/placement_v2_1.rb
219
+ - lib/misty/openstack/api/placement/v2_1.rb
220
+ - lib/misty/openstack/api/sahara/sahara_v1_1.rb
221
+ - lib/misty/openstack/api/sahara/v1_1.rb
222
+ - lib/misty/openstack/api/searchlight/searchlight_v1.rb
223
+ - lib/misty/openstack/api/searchlight/v1.rb
224
+ - lib/misty/openstack/api/senlin/senlin_v1.rb
225
+ - lib/misty/openstack/api/senlin/v1.rb
226
+ - lib/misty/openstack/api/swift/swift_v1.rb
227
+ - lib/misty/openstack/api/swift/v1.rb
228
+ - lib/misty/openstack/api/tacker/tacker_v1_0.rb
229
+ - lib/misty/openstack/api/tacker/v1_0.rb
230
+ - lib/misty/openstack/api/trove/trove_v1_0.rb
231
+ - lib/misty/openstack/api/trove/v1_0.rb
232
+ - lib/misty/openstack/api/watcher/v1.rb
233
+ - lib/misty/openstack/api/watcher/watcher_v1.rb
234
+ - lib/misty/openstack/api/zaqar/v2.rb
235
+ - lib/misty/openstack/api/zaqar/zaqar_v2.rb
236
+ - lib/misty/openstack/api/zun/v1.rb
237
+ - lib/misty/openstack/api/zun/zun_v1.rb
171
238
  - lib/misty/openstack/extension.rb
172
- - lib/misty/openstack/freezer/freezer_v1.rb
173
- - lib/misty/openstack/freezer/v1.rb
174
- - lib/misty/openstack/glance/glance_v1.rb
175
- - lib/misty/openstack/glance/glance_v2.rb
176
- - lib/misty/openstack/glance/v1.rb
177
- - lib/misty/openstack/glance/v2.rb
178
- - lib/misty/openstack/heat/heat_v1.rb
179
- - lib/misty/openstack/heat/v1.rb
180
- - lib/misty/openstack/ironic/ironic_v1.rb
181
- - lib/misty/openstack/ironic/v1.rb
182
- - lib/misty/openstack/karbor/karbor_v1.rb
183
- - lib/misty/openstack/karbor/v1.rb
184
- - lib/misty/openstack/keystone/keystone_v2_0.rb
185
- - lib/misty/openstack/keystone/keystone_v2_0_ext.rb
186
- - lib/misty/openstack/keystone/keystone_v3.rb
187
- - lib/misty/openstack/keystone/keystone_v3_ext.rb
188
- - lib/misty/openstack/keystone/v2_0.rb
189
- - lib/misty/openstack/keystone/v3.rb
190
- - lib/misty/openstack/magnum/magnum_v1.rb
191
- - lib/misty/openstack/magnum/v1.rb
192
- - lib/misty/openstack/manila/manila_v2.rb
193
- - lib/misty/openstack/manila/v2.rb
194
- - lib/misty/openstack/murano/murano_v1.rb
195
- - lib/misty/openstack/murano/v1.rb
196
- - lib/misty/openstack/neutron/neutron_v2_0.rb
197
- - lib/misty/openstack/neutron/v2_0.rb
198
- - lib/misty/openstack/nova/nova_v2_1.rb
199
- - lib/misty/openstack/nova/v2_1.rb
200
- - lib/misty/openstack/octavia/octavia_v2_0.rb
201
- - lib/misty/openstack/octavia/v2_0.rb
202
- - lib/misty/openstack/sahara/sahara_v1_1.rb
203
- - lib/misty/openstack/sahara/v1_1.rb
204
- - lib/misty/openstack/searchlight/searchlight_v1.rb
205
- - lib/misty/openstack/searchlight/v1.rb
206
- - lib/misty/openstack/senlin/senlin_v1.rb
207
- - lib/misty/openstack/senlin/v1.rb
208
239
  - lib/misty/openstack/service.rb
209
- - lib/misty/openstack/swift/swift_v1.rb
210
- - lib/misty/openstack/swift/v1.rb
211
- - lib/misty/openstack/tacker/tacker_v1_0.rb
212
- - lib/misty/openstack/tacker/v1_0.rb
213
- - lib/misty/openstack/trove/trove_v1_0.rb
214
- - lib/misty/openstack/trove/v1_0.rb
215
- - lib/misty/openstack/zaqar/v2.rb
216
- - lib/misty/openstack/zaqar/zaqar_v2.rb
240
+ - lib/misty/openstack/service_pack.rb
217
241
  - lib/misty/service.rb
218
242
  - lib/misty/services.rb
219
243
  - lib/misty/version.rb
220
244
  - test/integration/compute_test.rb
221
- - test/integration/networking_test.rb
245
+ - test/integration/network_test.rb
222
246
  - test/integration/orchestration_test.rb
223
247
  - test/integration/test_helper.rb
224
248
  - test/integration/vcr/compute_using_nova_v2_1.yml
225
- - test/integration/vcr/networking_using_neutron_v2_0.yml
249
+ - test/integration/vcr/network_using_neutron_v2_0.yml
226
250
  - test/integration/vcr/orchestration_using_heat_v1.yml
251
+ - test/unit/auth/catalog_test.rb
227
252
  - test/unit/auth/name_test.rb
253
+ - test/unit/auth/token_test.rb
228
254
  - test/unit/auth_helper.rb
229
- - test/unit/auth_test.rb
230
255
  - test/unit/cloud/config_test.rb
231
256
  - test/unit/cloud/requests_test.rb
232
257
  - test/unit/cloud/services_test.rb
@@ -1,91 +0,0 @@
1
- require 'logger'
2
- require 'misty/auth/name'
3
- require 'misty/http/net_http'
4
- require 'misty/config'
5
-
6
- module Misty
7
-
8
- # The credentials are a combination of "id" and "name" used to uniquely identify the context.
9
- # +Misty::Auth+ is mixing the common interface between +Misty::AuthV3+ and +Misty::AuthV2+
10
- #
11
- module Auth
12
- include Misty::HTTP::NetHTTP
13
-
14
- attr_reader :catalog, :token
15
-
16
- def self.build(auth)
17
- version = auth[:tenant_id] || auth[:tenant] ? 'V2' : 'V3'
18
- klass = Object.const_get("Misty::Auth#{version}")
19
- klass.new(auth)
20
- end
21
-
22
- # ==== Attributes
23
- #
24
- # * +auth+ - Hash of credentials parameters for authentication
25
- #
26
- def initialize(auth)
27
- if auth[:context]
28
- # bypass the authentication by given token catalog and expire date
29
- @token = auth[:context][:token]
30
- @catalog = auth[:context][:catalog]
31
- @expires = auth[:context][:expires]
32
- else
33
- raise URLError, 'No URL provided' if auth[:url].nil? || auth[:url].empty?
34
- @uri = URI.parse(auth[:url])
35
- @ssl_verify_mode = auth[:ssl_verify_mode] ? auth[:ssl_verify_mode] : Misty::Config::SSL_VERIFY_MODE
36
- @credentials = set_credentials(auth)
37
- @token, @catalog, @expires = set(authenticate)
38
- # TODO: Pass main log object
39
- @log = Logger.new('/dev/null')
40
- end
41
- end
42
-
43
- def authenticate
44
- Misty::HTTP::NetHTTP.http_request(
45
- @uri, ssl_verify_mode: @ssl_verify_mode, log: @log
46
- ) do |connection|
47
- response = connection.post(path, @credentials.to_json,
48
- { 'Content-Type' => 'application/json', 'Accept' => 'application/json' })
49
- unless response.code =~ /200|201/
50
- raise AuthenticationError, "Response code=#{response.code}, Msg=#{response.msg}"
51
- end
52
- response
53
- end
54
- end
55
-
56
- def expired?
57
- if @expires.nil? || @expires.empty?
58
- raise ExpiryError, 'Missing token expiration data'
59
- end
60
- Time.parse(@expires) < Time.now.utc
61
- end
62
-
63
- def get_url(service_names, region_id, interface)
64
- find_url(get_service(service_names), region_id, interface)
65
- end
66
-
67
- def get_service(service_names)
68
- @catalog.each do |service|
69
- return service if service_names.include?(service['type'])
70
- end
71
- raise CatalogError, "No service '#{service_names}' found."
72
- end
73
-
74
- def get_token
75
- @token, @catalog, @expires = set(authenticate) if expired?
76
- @token
77
- end
78
-
79
- def find_url(service, region_id, interface)
80
- if service['endpoints']
81
- service['endpoints'].each do |endpoint|
82
- if (url = endpoint_url(endpoint, region_id, interface))
83
- return url
84
- end
85
- end
86
- end
87
- message = "No endpoint found: service '#{service['type']}', region '#{region_id}', interface '#{interface}'"
88
- raise CatalogError, message
89
- end
90
- end
91
- end
@@ -1,65 +0,0 @@
1
- require 'misty/auth'
2
-
3
- module Misty
4
- #
5
- # Openstack Identity service Keystone version 2.0, which is deprecated, uses a tenant name or id to authenticates
6
- # +Misty::AuthV2+ is used if the authentication credentials contains a tenant name or id.
7
- class AuthV2
8
- include Misty::Auth
9
-
10
- def credentials
11
- if @token
12
- identity = { 'token': { 'id': @token } }
13
- else
14
- raise CredentialsError, "#{self.class}: User name is required" if @user.name.nil?
15
- raise CredentialsError, "#{self.class}: User password is required" if @user.password.nil?
16
- identity = { 'passwordCredentials': user_credentials }
17
- end
18
-
19
- if @tenant.id
20
- identity.merge!('tenantId': @tenant.id)
21
- elsif @tenant.name
22
- identity.merge!('tenantName': @tenant.name)
23
- else
24
- raise CredentialsError, "#{self.class}: No tenant available"
25
- end
26
-
27
- { 'auth': identity }
28
- end
29
-
30
- def endpoint_url(endpoint, region_id, interface)
31
- return endpoint["#{interface}URL"] if endpoint['region'] == region_id && endpoint["#{interface}URL"]
32
- end
33
-
34
- def path
35
- '/v2.0/tokens'
36
- end
37
-
38
- def user_credentials
39
- {
40
- 'username': @user.name,
41
- 'password': @user.password
42
- }
43
- end
44
-
45
- def set(response)
46
- payload = JSON.load(response.body)
47
- token = payload['access']['token']['id']
48
- catalog = payload['access']['serviceCatalog']
49
- expires = payload['access']['token']['expires']
50
- [token, catalog, expires]
51
- end
52
-
53
- def set_credentials(auth)
54
- if auth[:token]
55
- @token = auth[:token]
56
- else
57
- @user = Misty::Auth::User.new(auth[:user_id], auth[:user])
58
- @user.password = auth[:password]
59
- end
60
-
61
- @tenant = Misty::Auth::Name.new(auth[:tenant_id], auth[:tenant])
62
- credentials
63
- end
64
- end
65
- end