fog-openstack 0.1.31 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -1
- data/.travis.yml +5 -5
- data/.zuul.yaml +8 -8
- data/Rakefile +14 -4
- data/fog-openstack.gemspec +3 -2
- data/lib/fog/baremetal/openstack.rb +6 -24
- data/lib/fog/compute/openstack.rb +6 -27
- data/lib/fog/compute/openstack/requests/create_security_group.rb +1 -1
- data/lib/fog/compute/openstack/requests/create_server.rb +1 -1
- data/lib/fog/compute/openstack/requests/evacuate_server.rb +1 -5
- data/lib/fog/container_infra/openstack.rb +6 -25
- data/lib/fog/dns/openstack/v1.rb +5 -17
- data/lib/fog/dns/openstack/v2.rb +5 -22
- data/lib/fog/event/openstack.rb +5 -24
- data/lib/fog/identity/openstack.rb +24 -71
- data/lib/fog/identity/openstack/v2.rb +6 -4
- data/lib/fog/identity/openstack/v3.rb +5 -11
- data/lib/fog/image/openstack/v1.rb +8 -21
- data/lib/fog/image/openstack/v2.rb +8 -21
- data/lib/fog/image/openstack/v2/models/image.rb +1 -1
- data/lib/fog/introspection/openstack.rb +4 -19
- data/lib/fog/key_manager/openstack.rb +5 -47
- data/lib/fog/metering/openstack.rb +8 -23
- data/lib/fog/metric/openstack.rb +7 -26
- data/lib/fog/monitoring/openstack.rb +3 -12
- data/lib/fog/network/openstack.rb +5 -26
- data/lib/fog/network/openstack/requests/set_tenant.rb +0 -1
- data/lib/fog/nfv/openstack.rb +4 -24
- data/lib/fog/openstack.rb +17 -431
- data/lib/fog/openstack/auth/catalog.rb +64 -0
- data/lib/fog/openstack/auth/catalog/v2.rb +23 -0
- data/lib/fog/openstack/auth/catalog/v3.rb +23 -0
- data/lib/fog/openstack/auth/name.rb +65 -0
- data/lib/fog/openstack/auth/token.rb +69 -0
- data/lib/fog/openstack/auth/token/v2.rb +70 -0
- data/lib/fog/openstack/auth/token/v3.rb +116 -0
- data/lib/fog/openstack/core.rb +100 -76
- data/lib/fog/openstack/version.rb +1 -1
- data/lib/fog/orchestration/openstack.rb +4 -21
- data/lib/fog/planning/openstack.rb +13 -23
- data/lib/fog/shared_file_system/openstack.rb +10 -27
- data/lib/fog/storage/openstack.rb +6 -11
- data/lib/fog/volume/openstack.rb +1 -1
- data/lib/fog/volume/openstack/models/backup.rb +2 -2
- data/lib/fog/volume/openstack/requests/restore_backup.rb +2 -2
- data/lib/fog/volume/openstack/requests/update_volume.rb +12 -1
- data/lib/fog/volume/openstack/v1.rb +4 -21
- data/lib/fog/volume/openstack/v1/models/volume.rb +1 -2
- data/lib/fog/volume/openstack/v1/requests/update_volume.rb +0 -17
- data/lib/fog/volume/openstack/v2.rb +4 -21
- data/lib/fog/volume/openstack/v2/models/volume.rb +1 -1
- data/lib/fog/volume/openstack/v2/requests/update_volume.rb +0 -18
- data/lib/fog/workflow/openstack/v2.rb +5 -22
- data/playbooks/fog-openstack-unittest-spec/run.yaml +2 -1
- data/playbooks/fog-openstack-unittest-test/run.yaml +2 -1
- data/unit/auth/catalog_test.rb +252 -0
- data/unit/auth/name_test.rb +115 -0
- data/unit/auth/token_test.rb +478 -0
- data/unit/auth_helper.rb +102 -0
- data/unit/test_helper.rb +6 -0
- metadata +41 -16
- data/lib/fog/compute/openstack/requests/list_tenants.rb +0 -43
@@ -13,7 +13,7 @@ module Fog
|
|
13
13
|
:openstack_project_name, :openstack_project_id,
|
14
14
|
:openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
|
15
15
|
:openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id,
|
16
|
-
:
|
16
|
+
:openstack_identity_api_version
|
17
17
|
|
18
18
|
model_path 'fog/orchestration/openstack/models'
|
19
19
|
model :stack
|
@@ -105,10 +105,6 @@ module Fog
|
|
105
105
|
management_url.port = 8774
|
106
106
|
management_url.path = '/v1'
|
107
107
|
@openstack_management_url = management_url.to_s
|
108
|
-
|
109
|
-
identity_public_endpoint = URI.parse(options[:openstack_auth_url])
|
110
|
-
identity_public_endpoint.port = 5000
|
111
|
-
@openstack_identity_public_endpoint = identity_public_endpoint.to_s
|
112
108
|
end
|
113
109
|
|
114
110
|
def data
|
@@ -123,8 +119,7 @@ module Fog
|
|
123
119
|
{:provider => 'openstack',
|
124
120
|
:openstack_auth_url => @openstack_auth_uri.to_s,
|
125
121
|
:openstack_auth_token => @auth_token,
|
126
|
-
:openstack_management_url => @openstack_management_url
|
127
|
-
:openstack_identity_endpoint => @openstack_identity_public_endpoint}
|
122
|
+
:openstack_management_url => @openstack_management_url}
|
128
123
|
end
|
129
124
|
end
|
130
125
|
|
@@ -135,20 +130,8 @@ module Fog
|
|
135
130
|
Fog::Orchestration::OpenStack::NotFound
|
136
131
|
end
|
137
132
|
|
138
|
-
def
|
139
|
-
|
140
|
-
|
141
|
-
@openstack_identity_service_type = options[:openstack_identity_service_type] || 'identity'
|
142
|
-
|
143
|
-
@openstack_service_type = options[:openstack_service_type] || ['orchestration']
|
144
|
-
@openstack_service_name = options[:openstack_service_name]
|
145
|
-
|
146
|
-
@connection_options = options[:connection_options] || {}
|
147
|
-
|
148
|
-
authenticate
|
149
|
-
|
150
|
-
@persistent = options[:persistent] || false
|
151
|
-
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
133
|
+
def default_service_type
|
134
|
+
%w[orchestration]
|
152
135
|
end
|
153
136
|
end
|
154
137
|
end
|
@@ -15,7 +15,7 @@ module Fog
|
|
15
15
|
:openstack_project_name, :openstack_project_id,
|
16
16
|
:openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
|
17
17
|
:openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id,
|
18
|
-
:
|
18
|
+
:openstack_identity_api_version
|
19
19
|
|
20
20
|
## MODELS
|
21
21
|
#
|
@@ -97,32 +97,22 @@ module Fog
|
|
97
97
|
class Real
|
98
98
|
include Fog::OpenStack::Core
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
# end
|
104
|
-
|
105
|
-
def initialize(options = {})
|
106
|
-
initialize_identity options
|
107
|
-
|
108
|
-
@openstack_service_type = options[:openstack_service_type] || ['management'] # currently Tuskar is configured as 'management' service in Keystone
|
109
|
-
@openstack_service_name = options[:openstack_service_name]
|
110
|
-
@openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
|
111
|
-
|
112
|
-
@connection_options = options[:connection_options] || {}
|
113
|
-
|
114
|
-
authenticate
|
115
|
-
set_api_path
|
100
|
+
def default_endpoint_type
|
101
|
+
'admin'
|
102
|
+
end
|
116
103
|
|
117
|
-
|
118
|
-
|
104
|
+
def default_path_prefix
|
105
|
+
'v2'
|
119
106
|
end
|
120
107
|
|
121
|
-
def
|
122
|
-
|
123
|
-
@path = "/v2"
|
124
|
-
end
|
108
|
+
def default_service_type
|
109
|
+
%w[management]
|
125
110
|
end
|
111
|
+
|
112
|
+
# NOTE: uncommenting this should be treated as api-change!
|
113
|
+
# def self.not_found_class
|
114
|
+
# Fog::Planning::OpenStack::NotFound
|
115
|
+
# end
|
126
116
|
end
|
127
117
|
end
|
128
118
|
|
@@ -14,7 +14,7 @@ module Fog
|
|
14
14
|
:openstack_project_name, :openstack_project_id,
|
15
15
|
:openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
|
16
16
|
:openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id,
|
17
|
-
:
|
17
|
+
:openstack_identity_api_version, :openstack_shared_file_system_microversion
|
18
18
|
|
19
19
|
model_path 'fog/shared_file_system/openstack/models'
|
20
20
|
model :network
|
@@ -351,37 +351,20 @@ module Fog
|
|
351
351
|
Fog::SharedFileSystem::OpenStack::NotFound
|
352
352
|
end
|
353
353
|
|
354
|
+
def action_prefix
|
355
|
+
microversion_newer_than?('2.6') ? '' : 'os-'
|
356
|
+
end
|
357
|
+
|
358
|
+
def default_service_type
|
359
|
+
%w[sharev2]
|
360
|
+
end
|
361
|
+
|
354
362
|
def initialize(options = {})
|
355
363
|
@supported_versions = SUPPORTED_VERSIONS
|
356
364
|
@supported_microversion = SUPPORTED_MICROVERSION
|
357
365
|
@fixed_microversion = options[:openstack_shared_file_system_microversion]
|
358
366
|
@microversion_key = 'X-Openstack-Manila-Api-Version'.freeze
|
359
|
-
|
360
|
-
initialize_identity options
|
361
|
-
|
362
|
-
@openstack_service_type = options[:openstack_service_type] || ['sharev2']
|
363
|
-
@openstack_service_name = options[:openstack_service_name]
|
364
|
-
@connection_options = options[:connection_options] || {}
|
365
|
-
|
366
|
-
authenticate
|
367
|
-
set_api_path
|
368
|
-
set_microversion
|
369
|
-
|
370
|
-
@persistent = options[:persistent] || false
|
371
|
-
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
372
|
-
end
|
373
|
-
|
374
|
-
def set_api_path
|
375
|
-
unless @path.match(@supported_versions)
|
376
|
-
@path = Fog::OpenStack.get_supported_version_path(@supported_versions,
|
377
|
-
@openstack_management_uri,
|
378
|
-
@auth_token,
|
379
|
-
@connection_options)
|
380
|
-
end
|
381
|
-
end
|
382
|
-
|
383
|
-
def action_prefix
|
384
|
-
microversion_newer_than?('2.6') ? '' : 'os-'
|
367
|
+
super
|
385
368
|
end
|
386
369
|
end
|
387
370
|
end
|
@@ -13,7 +13,7 @@ module Fog
|
|
13
13
|
:openstack_project_name, :openstack_project_id, :openstack_cache_ttl,
|
14
14
|
:openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
|
15
15
|
:openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id,
|
16
|
-
:
|
16
|
+
:openstack_identity_api_version, :openstack_temp_url_key
|
17
17
|
|
18
18
|
model_path 'fog/storage/openstack/models'
|
19
19
|
model :directory
|
@@ -112,18 +112,13 @@ module Fog
|
|
112
112
|
Fog::Storage::OpenStack::NotFound
|
113
113
|
end
|
114
114
|
|
115
|
+
def default_service_type
|
116
|
+
%w[object-store]
|
117
|
+
end
|
118
|
+
|
115
119
|
def initialize(options = {})
|
116
120
|
require_mime_types
|
117
|
-
|
118
|
-
|
119
|
-
@openstack_service_type = options[:openstack_service_type] || ['object-store']
|
120
|
-
@openstack_service_name = options[:openstack_service_name]
|
121
|
-
|
122
|
-
@connection_options = options[:connection_options] || {}
|
123
|
-
|
124
|
-
authenticate
|
125
|
-
@persistent = options[:persistent] || false
|
126
|
-
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
121
|
+
super
|
127
122
|
end
|
128
123
|
|
129
124
|
# Change the current account while re-using the auth token.
|
data/lib/fog/volume/openstack.rb
CHANGED
@@ -15,7 +15,7 @@ module Fog
|
|
15
15
|
:openstack_project_name, :openstack_project_id,
|
16
16
|
:openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
|
17
17
|
:openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id,
|
18
|
-
:
|
18
|
+
:openstack_identity_api_version]
|
19
19
|
|
20
20
|
# Fog::Image::OpenStack.new() will return a Fog::Volume::OpenStack::V2 or a Fog::Volume::OpenStack::V1,
|
21
21
|
# choosing the V2 by default, as V1 is deprecated since OpenStack Juno
|
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module Volume
|
3
3
|
class OpenStack
|
4
4
|
module Real
|
5
|
-
def restore_backup(backup_id, volume_id)
|
6
|
-
data = {
|
5
|
+
def restore_backup(backup_id, volume_id = nil, name = nil)
|
6
|
+
data = {'restore' => {'volume_id' => volume_id, 'name' => name}}
|
7
7
|
request(
|
8
8
|
:expects => 202,
|
9
9
|
:method => 'POST',
|
@@ -1,7 +1,18 @@
|
|
1
1
|
module Fog
|
2
2
|
module Volume
|
3
3
|
class OpenStack
|
4
|
-
|
4
|
+
module Real
|
5
|
+
def update_volume(volume_id, data = {})
|
6
|
+
request(
|
7
|
+
:body => Fog::JSON.encode('volume' => data),
|
8
|
+
:expects => 200,
|
9
|
+
:method => 'PUT',
|
10
|
+
:path => "volumes/#{volume_id}"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Mock
|
5
16
|
def update_volume(volume_id, data = {})
|
6
17
|
response = Excon::Response.new
|
7
18
|
response.status = 200
|
@@ -152,29 +152,12 @@ module Fog
|
|
152
152
|
Fog::Volume::OpenStack::NotFound
|
153
153
|
end
|
154
154
|
|
155
|
-
def
|
156
|
-
|
157
|
-
|
158
|
-
@openstack_service_type = options[:openstack_service_type] || ['volume']
|
159
|
-
@openstack_service_name = options[:openstack_service_name]
|
160
|
-
@openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
|
161
|
-
|
162
|
-
@connection_options = options[:connection_options] || {}
|
163
|
-
|
164
|
-
authenticate
|
165
|
-
set_api_path
|
166
|
-
|
167
|
-
@persistent = options[:persistent] || false
|
168
|
-
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
155
|
+
def default_endtpoint_type
|
156
|
+
'admin'
|
169
157
|
end
|
170
158
|
|
171
|
-
def
|
172
|
-
|
173
|
-
@path = Fog::OpenStack.get_supported_version_path(SUPPORTED_VERSIONS,
|
174
|
-
@openstack_management_uri,
|
175
|
-
@auth_token,
|
176
|
-
@connection_options)
|
177
|
-
end
|
159
|
+
def default_service_type
|
160
|
+
%w[volume]
|
178
161
|
end
|
179
162
|
end
|
180
163
|
end
|
@@ -17,8 +17,7 @@ module Fog
|
|
17
17
|
data = if id.nil?
|
18
18
|
service.create_volume(display_name, display_description, size, attributes)
|
19
19
|
else
|
20
|
-
|
21
|
-
service.update_volume(id, attrib)
|
20
|
+
service.update_volume(id, attributes.reject { |k, _v| k == :id })
|
22
21
|
end
|
23
22
|
merge_attributes(data.body['volume'])
|
24
23
|
true
|
@@ -1,19 +1,2 @@
|
|
1
1
|
require 'fog/volume/openstack/requests/update_volume'
|
2
2
|
require 'fog/volume/openstack/v1/requests/real'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module Volume
|
6
|
-
class OpenStack
|
7
|
-
module Real
|
8
|
-
def update_volume(volume_id, data = {})
|
9
|
-
request(
|
10
|
-
:body => Fog::JSON.encode('volume' => data),
|
11
|
-
:expects => 200,
|
12
|
-
:method => 'PUT',
|
13
|
-
:path => "volumes/#{volume_id}"
|
14
|
-
)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -154,29 +154,12 @@ module Fog
|
|
154
154
|
Fog::Volume::OpenStack::NotFound
|
155
155
|
end
|
156
156
|
|
157
|
-
def
|
158
|
-
|
159
|
-
|
160
|
-
@openstack_service_type = options[:openstack_service_type] || ['volumev2']
|
161
|
-
@openstack_service_name = options[:openstack_service_name]
|
162
|
-
@openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
|
163
|
-
|
164
|
-
@connection_options = options[:connection_options] || {}
|
165
|
-
|
166
|
-
authenticate
|
167
|
-
set_api_path
|
168
|
-
|
169
|
-
@persistent = options[:persistent] || false
|
170
|
-
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
157
|
+
def default_endtpoint_type
|
158
|
+
'admin'
|
171
159
|
end
|
172
160
|
|
173
|
-
def
|
174
|
-
|
175
|
-
@path = Fog::OpenStack.get_supported_version_path(SUPPORTED_VERSIONS,
|
176
|
-
@openstack_management_uri,
|
177
|
-
@auth_token,
|
178
|
-
@connection_options)
|
179
|
-
end
|
161
|
+
def default_service_type
|
162
|
+
%w[volumev2]
|
180
163
|
end
|
181
164
|
end
|
182
165
|
end
|
@@ -17,7 +17,7 @@ module Fog
|
|
17
17
|
data = if id.nil?
|
18
18
|
service.create_volume(name, description, size, attributes)
|
19
19
|
else
|
20
|
-
service.update_volume(id, attributes.
|
20
|
+
service.update_volume(id, attributes.reject { |k, _v| k == :id })
|
21
21
|
end
|
22
22
|
merge_attributes(data.body['volume'])
|
23
23
|
true
|
@@ -1,20 +1,2 @@
|
|
1
1
|
require 'fog/volume/openstack/requests/update_volume'
|
2
2
|
require 'fog/volume/openstack/v2/requests/real'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module Volume
|
6
|
-
class OpenStack
|
7
|
-
module Real
|
8
|
-
def update_volume(volume_id, data = {})
|
9
|
-
data = data.select { |key| key == :name || key == :description || key == :metadata }
|
10
|
-
request(
|
11
|
-
:body => Fog::JSON.encode('volume' => data),
|
12
|
-
:expects => 200,
|
13
|
-
:method => 'PUT',
|
14
|
-
:path => "volumes/#{volume_id}"
|
15
|
-
)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -83,8 +83,6 @@ module Fog
|
|
83
83
|
def initialize(options = {})
|
84
84
|
@auth_token = Fog::Mock.random_base64(64)
|
85
85
|
@auth_token_expiration = (Time.now.utc + 86_400).iso8601
|
86
|
-
|
87
|
-
initialize_identity options
|
88
86
|
end
|
89
87
|
|
90
88
|
def data
|
@@ -99,27 +97,12 @@ module Fog
|
|
99
97
|
class Real
|
100
98
|
include Fog::OpenStack::Core
|
101
99
|
|
102
|
-
def
|
103
|
-
|
104
|
-
|
105
|
-
@openstack_service_type = options[:openstack_service_type] || ['workflowv2']
|
106
|
-
@openstack_service_name = options[:openstack_service_name]
|
107
|
-
|
108
|
-
@connection_options = options[:connection_options] || {}
|
109
|
-
|
110
|
-
authenticate
|
111
|
-
|
112
|
-
unless @path.match(SUPPORTED_VERSIONS)
|
113
|
-
@path = "/" + Fog::OpenStack.get_supported_version(
|
114
|
-
SUPPORTED_VERSIONS,
|
115
|
-
@openstack_management_uri,
|
116
|
-
@auth_token,
|
117
|
-
@connection_options
|
118
|
-
)
|
119
|
-
end
|
100
|
+
def default_path_prefix
|
101
|
+
'v2'
|
102
|
+
end
|
120
103
|
|
121
|
-
|
122
|
-
|
104
|
+
def default_service_type
|
105
|
+
%w[workflowv2]
|
123
106
|
end
|
124
107
|
|
125
108
|
def request(params)
|
@@ -24,7 +24,8 @@
|
|
24
24
|
rvm use ${version} > /dev/null 2>&1
|
25
25
|
echo "Running tests based on Ruby ${version}..."
|
26
26
|
ruby --version
|
27
|
-
gem install bundler
|
27
|
+
gem install bundler
|
28
|
+
gem update bundler
|
28
29
|
bundle install --jobs=3 --retry=3
|
29
30
|
bundle exec rake spec TESTOPTS="--verbose"
|
30
31
|
done
|