vagrant-openstack-provider 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -2
- data/Gemfile +1 -5
- data/lib/vagrant-openstack-provider/client/keystone.rb +2 -2
- data/lib/vagrant-openstack-provider/client/rest_utils.rb +11 -0
- data/lib/vagrant-openstack-provider/config.rb +24 -3
- data/lib/vagrant-openstack-provider/config/http.rb +6 -0
- data/lib/vagrant-openstack-provider/utils.rb +1 -1
- data/lib/vagrant-openstack-provider/version.rb +1 -1
- data/lib/vagrant-openstack-provider/version_checker.rb +25 -7
- data/locales/en.yml +6 -2
- data/spec/vagrant-openstack-provider/action/connect_openstack_spec.rb +2 -1
- data/spec/vagrant-openstack-provider/client/cinder_spec.rb +1 -0
- data/spec/vagrant-openstack-provider/client/glance_spec.rb +1 -0
- data/spec/vagrant-openstack-provider/client/heat_spec.rb +1 -0
- data/spec/vagrant-openstack-provider/client/keystone_spec.rb +5 -2
- data/spec/vagrant-openstack-provider/client/neutron_spec.rb +1 -0
- data/spec/vagrant-openstack-provider/client/nova_spec.rb +1 -0
- data/spec/vagrant-openstack-provider/version_checker_spec.rb +2 -2
- data/vagrant-openstack-provider.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1062d3b235767d1459f0fc018c419b688620f69e
|
4
|
+
data.tar.gz: 28314e50ec001ed36d5f00a975239cd9e18268e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 977c2d6ab3a78601e6cd0d3ed307d79d7ef2218f0a86870e705c908de2a0e674e6ce4dbc97a63b22a2520ba71b3a9db89941d4c966356413f14457ec8afeae23
|
7
|
+
data.tar.gz: bea47c2f131dc201c8aa0ea133de2a7781a48f795ac510ec539f39638971f595a6783740d48f6dfdc8a78e979055f63743c2ac4c376effd9406e8cca0f491baf
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
# 0.13.0 (July 30, 2018)
|
2
|
+
|
3
|
+
See https://github.com/ggiamarchi/vagrant-openstack-provider/milestone/20?closed=1
|
4
|
+
|
1
5
|
# 0.12.0 (February 26, 2018)
|
2
6
|
|
3
|
-
|
7
|
+
See https://github.com/ggiamarchi/vagrant-openstack-provider/milestone/19?closed=1
|
4
8
|
|
5
|
-
- Support parallel actions (#130)
|
6
9
|
|
7
10
|
# 0.11.0 (August 5, 2017)
|
8
11
|
|
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v1.9.
|
6
|
+
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v1.9.8'
|
7
7
|
# FIXME: Hack to allow Vagrant v1.6.5 to install for tests. Remove when
|
8
8
|
# support for 1.6.5 is dropped.
|
9
9
|
gem 'rack', '< 2'
|
@@ -16,7 +16,3 @@ end
|
|
16
16
|
group :debug do
|
17
17
|
gem 'byebug'
|
18
18
|
end
|
19
|
-
|
20
|
-
group :plugins do
|
21
|
-
gem 'vagrant-openstack-provider', path: '.'
|
22
|
-
end
|
@@ -96,7 +96,7 @@ module VagrantPlugins
|
|
96
96
|
user: {
|
97
97
|
name: config.username,
|
98
98
|
domain: {
|
99
|
-
name: config.
|
99
|
+
name: config.user_domain_name
|
100
100
|
},
|
101
101
|
password: '****'
|
102
102
|
}
|
@@ -105,7 +105,7 @@ module VagrantPlugins
|
|
105
105
|
scope: {
|
106
106
|
project: {
|
107
107
|
name: config.project_name,
|
108
|
-
domain: { name: config.
|
108
|
+
domain: { name: config.project_domain_name }
|
109
109
|
}
|
110
110
|
}
|
111
111
|
}
|
@@ -3,8 +3,17 @@ require 'restclient'
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module Openstack
|
5
5
|
module RestUtils
|
6
|
+
def self._set_proxy(config)
|
7
|
+
@logger = Log4r::Logger.new('vagrant_openstack::restutils')
|
8
|
+
if config.http.proxy
|
9
|
+
RestClient.proxy = config.http.proxy
|
10
|
+
@logger.info "Setting up HTTP proxy to '#{config.http.proxy}'"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
6
14
|
def self.get(env, url, headers = {}, &block)
|
7
15
|
config = env[:machine].provider_config
|
16
|
+
_set_proxy(config)
|
8
17
|
RestClient::Request.execute(method: :get, url: url, headers: headers,
|
9
18
|
timeout: config.http.read_timeout, open_timeout: config.http.open_timeout,
|
10
19
|
ssl_ca_file: config.ssl_ca_file, verify_ssl: config.ssl_verify_peer, &block)
|
@@ -12,6 +21,7 @@ module VagrantPlugins
|
|
12
21
|
|
13
22
|
def self.post(env, url, payload, headers = {}, &block)
|
14
23
|
config = env[:machine].provider_config
|
24
|
+
_set_proxy(config)
|
15
25
|
RestClient::Request.execute(method: :post, url: url, payload: payload, headers: headers,
|
16
26
|
timeout: config.http.read_timeout, open_timeout: config.http.open_timeout,
|
17
27
|
ssl_ca_file: config.ssl_ca_file, verify_ssl: config.ssl_verify_peer, &block)
|
@@ -19,6 +29,7 @@ module VagrantPlugins
|
|
19
29
|
|
20
30
|
def self.delete(env, url, headers = {}, &block)
|
21
31
|
config = env[:machine].provider_config
|
32
|
+
_set_proxy(config)
|
22
33
|
RestClient::Request.execute(method: :delete, url: url, headers: headers,
|
23
34
|
timeout: config.http.read_timeout, open_timeout: config.http.open_timeout,
|
24
35
|
ssl_ca_file: config.ssl_ca_file, verify_ssl: config.ssl_verify_peer, &block)
|
@@ -72,6 +72,16 @@ module VagrantPlugins
|
|
72
72
|
# @return [String]
|
73
73
|
attr_accessor :domain_name
|
74
74
|
|
75
|
+
# The user domain name to access Openstack, this defaults to Default.
|
76
|
+
#
|
77
|
+
# @return [String]
|
78
|
+
attr_accessor :user_domain_name
|
79
|
+
|
80
|
+
# The project domain name to access Openstack, this defaults to Default.
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
attr_accessor :project_domain_name
|
84
|
+
|
75
85
|
# The name of the keypair to use.
|
76
86
|
#
|
77
87
|
# @return [String]
|
@@ -302,6 +312,7 @@ module VagrantPlugins
|
|
302
312
|
@use_legacy_synced_folders = UNSET_VALUE
|
303
313
|
@ssl_ca_file = UNSET_VALUE
|
304
314
|
@ssl_verify_peer = UNSET_VALUE
|
315
|
+
@domain_name = UNSET_VALUE
|
305
316
|
end
|
306
317
|
|
307
318
|
def merge(other)
|
@@ -362,7 +373,9 @@ module VagrantPlugins
|
|
362
373
|
@project_name = nil if @project_name == UNSET_VALUE
|
363
374
|
@server_name = nil if @server_name == UNSET_VALUE
|
364
375
|
@username = nil if @username == UNSET_VALUE
|
365
|
-
|
376
|
+
# If domain_name is set we use it for user and project
|
377
|
+
@user_domain_name = @domain_name if @domain_name != UNSET_VALUE
|
378
|
+
@project_domain_name = @domain_name if @domain_name != UNSET_VALUE
|
366
379
|
@floating_ip = nil if @floating_ip == UNSET_VALUE
|
367
380
|
@floating_ip_pool = nil if @floating_ip_pool == UNSET_VALUE
|
368
381
|
@floating_ip_pool_always_allocate = false if floating_ip_pool_always_allocate == UNSET_VALUE
|
@@ -423,7 +436,7 @@ module VagrantPlugins
|
|
423
436
|
def rsync_include(inc)
|
424
437
|
@rsync_includes << inc
|
425
438
|
end
|
426
|
-
|
439
|
+
# rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
427
440
|
def validate(machine)
|
428
441
|
errors = _detected_errors
|
429
442
|
|
@@ -465,7 +478,15 @@ module VagrantPlugins
|
|
465
478
|
errors << I18n.t('vagrant_openstack.config.tenant_name_required') if @tenant_name.nil? || @tenant_name.empty?
|
466
479
|
errors << I18n.t('vagrant_openstack.config.invalid_endpoint_type') unless %w(publicURL adminURL internalURL).include?(@endpoint_type)
|
467
480
|
elsif @identity_api_version == '3'
|
468
|
-
|
481
|
+
if @domain_name == UNSET_VALUE || @domain_name.nil? || @domain_name.empty?
|
482
|
+
if (@user_domain_name.nil? || @user_domain_name.empty?) && (@project_domain_name_name.nil? || @project_domain_name.empty?)
|
483
|
+
errors << I18n.t('vagrant_openstack.config.domain_required')
|
484
|
+
elsif @user_domain_name.nil? || @user_domain_name.empty?
|
485
|
+
errors << I18n.t('vagrant_openstack.config.user_domain_required')
|
486
|
+
elsif @project_domain_name.nil? || @project_domain_name.empty?
|
487
|
+
errors << I18n.t('vagrant_openstack.config.project_domain_required')
|
488
|
+
end
|
489
|
+
end
|
469
490
|
errors << I18n.t('vagrant_openstack.config.project_name_required') if @project_name.nil? || @project_name.empty?
|
470
491
|
errors << I18n.t('vagrant_openstack.config.invalid_interface_type') unless %w(public admin internal).include?(@interface_type)
|
471
492
|
end
|
@@ -11,14 +11,20 @@ module VagrantPlugins
|
|
11
11
|
# @return [Integer]
|
12
12
|
attr_accessor :read_timeout
|
13
13
|
|
14
|
+
#
|
15
|
+
# @return [Integer]
|
16
|
+
attr_accessor :proxy
|
17
|
+
|
14
18
|
def initialize
|
15
19
|
@open_timeout = UNSET_VALUE
|
16
20
|
@read_timeout = UNSET_VALUE
|
21
|
+
@proxy = UNSET_VALUE
|
17
22
|
end
|
18
23
|
|
19
24
|
def finalize!
|
20
25
|
@open_timeout = 60 if @open_timeout == UNSET_VALUE
|
21
26
|
@read_timeout = 30 if @read_timeout == UNSET_VALUE
|
27
|
+
@proxy = nil if @proxy == UNSET_VALUE
|
22
28
|
end
|
23
29
|
|
24
30
|
def merge(other)
|
@@ -13,7 +13,7 @@ module VagrantPlugins
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
fail Errors::UnableToResolveIP if addresses.size == 0
|
16
|
-
if addresses.size == 1
|
16
|
+
if addresses.size == 1 || !env[:machine].provider_config.networks
|
17
17
|
net_addresses = addresses.first[1]
|
18
18
|
else
|
19
19
|
first_network = env[:machine].provider_config.networks[0]
|
@@ -16,21 +16,39 @@ module VagrantPlugins
|
|
16
16
|
#
|
17
17
|
attr_accessor :status
|
18
18
|
|
19
|
+
#
|
20
|
+
# boolean attribute to disbale version checker
|
21
|
+
#
|
22
|
+
attr_accessor :check_enabled
|
23
|
+
|
19
24
|
def initialize
|
20
25
|
@status = nil
|
26
|
+
@check_enabled = true
|
27
|
+
|
28
|
+
check = ENV['VAGRANT_OPENSTACK_VERSION_CKECK']
|
29
|
+
@check_enabled = false if check && check.upcase == 'DISABLED'
|
21
30
|
end
|
22
31
|
|
23
32
|
#
|
24
33
|
# Check the latest version from rubygem and set the status
|
25
34
|
#
|
26
35
|
def check
|
36
|
+
return :latest unless @check_enabled
|
27
37
|
return @status unless @status.nil?
|
28
|
-
|
38
|
+
|
39
|
+
begin
|
40
|
+
latest = Gem.latest_spec_for('vagrant-openstack-provider').version.version
|
41
|
+
rescue
|
42
|
+
# If for any reason the version of the latest pulished
|
43
|
+
# version can't be found we don't fail in any way
|
44
|
+
return :latest
|
45
|
+
end
|
46
|
+
|
29
47
|
current = VagrantPlugins::Openstack::VERSION
|
30
48
|
|
31
49
|
unless current =~ VERSION_PATTERN
|
32
50
|
@status = :unstable
|
33
|
-
|
51
|
+
print_message I18n.t('vagrant_openstack.version_unstable')
|
34
52
|
return
|
35
53
|
end
|
36
54
|
|
@@ -47,19 +65,19 @@ module VagrantPlugins
|
|
47
65
|
|
48
66
|
if i_current > i_latest
|
49
67
|
@status = :unstable
|
50
|
-
|
68
|
+
print_message I18n.t('vagrant_openstack.version_unstable')
|
51
69
|
return
|
52
70
|
end
|
53
71
|
|
54
72
|
@status = :outdated
|
55
|
-
|
73
|
+
print_message I18n.t('vagrant_openstack.version_outdated', latest: latest, current: current)
|
56
74
|
end
|
57
75
|
|
58
76
|
private
|
59
77
|
|
60
|
-
def
|
61
|
-
puts message.yellow
|
62
|
-
puts ''
|
78
|
+
def print_message(message)
|
79
|
+
$stderr.puts message.yellow
|
80
|
+
$stderr.puts ''
|
63
81
|
end
|
64
82
|
end
|
65
83
|
|
data/locales/en.yml
CHANGED
@@ -146,13 +146,17 @@ en:
|
|
146
146
|
settings causes the OpenStack provider to fall back to an old synced
|
147
147
|
folder implementation instead of using standard Vagrant synced folders.
|
148
148
|
domain_required: |-
|
149
|
-
A domain is required when using identity API version 3
|
149
|
+
A domain is required when using identity API version 3. You need to specify domain_name or (project_domain_name and user_domain_name)
|
150
|
+
user_domain_required: |-
|
151
|
+
A user domain is required when specifying a project domain using identity API version 3.
|
152
|
+
project_domain_required: |-
|
153
|
+
A project domain is required when specifying a user domain using identity API version 3.
|
150
154
|
project_name_required: |-
|
151
155
|
A project name is required when using identity API version 3
|
152
156
|
invalid_interface_type: |-
|
153
157
|
Interface type must be public, admin or internal (if not provided, default is public)
|
154
158
|
invalid_api_version: |-
|
155
|
-
identity API verison must be 2 or 3 (if
|
159
|
+
identity API verison must be 2 or 3 (if not provided, default is 2)
|
156
160
|
|
157
161
|
errors:
|
158
162
|
default: |-
|
@@ -305,7 +305,8 @@ describe VagrantPlugins::Openstack::Action::ConnectOpenstack do
|
|
305
305
|
end
|
306
306
|
env[:openstack_client].stub(:neutron) { neutron }
|
307
307
|
env[:openstack_client].stub(:glance) { glance }
|
308
|
-
config.stub(:
|
308
|
+
config.stub(:user_domain_name) { 'dummy' }
|
309
|
+
config.stub(:project_domain_name) { 'dummy' }
|
309
310
|
config.stub(:identity_api_version) { '3' }
|
310
311
|
|
311
312
|
@action.call(env)
|
@@ -5,6 +5,7 @@ describe VagrantPlugins::Openstack::KeystoneClient do
|
|
5
5
|
double('http').tap do |http|
|
6
6
|
http.stub(:read_timeout) { 42 }
|
7
7
|
http.stub(:open_timeout) { 43 }
|
8
|
+
http.stub(:proxy) { nil }
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
@@ -178,7 +179,8 @@ describe VagrantPlugins::Openstack::KeystoneClient do
|
|
178
179
|
# V3
|
179
180
|
context 'with good credentials v3' do
|
180
181
|
it 'store token and tenant id' do
|
181
|
-
config.stub(:
|
182
|
+
config.stub(:user_domain_name) { 'dummy' }
|
183
|
+
config.stub(:project_domain_name) { 'dummy' }
|
182
184
|
config.stub(:identity_api_version) { '3' }
|
183
185
|
config.stub(:openstack_auth_url) { 'http://keystoneAuthV3' }
|
184
186
|
|
@@ -200,7 +202,8 @@ describe VagrantPlugins::Openstack::KeystoneClient do
|
|
200
202
|
|
201
203
|
context 'with wrong credentials v3' do
|
202
204
|
it 'raise an unauthorized error ' do
|
203
|
-
config.stub(:
|
205
|
+
config.stub(:user_domain_name) { 'dummy' }
|
206
|
+
config.stub(:project_domain_name) { 'dummy' }
|
204
207
|
config.stub(:identity_api_version) { '3' }
|
205
208
|
config.stub(:openstack_auth_url) { 'http://keystoneAuthV3' }
|
206
209
|
|
@@ -31,8 +31,8 @@ describe VagrantPlugins::Openstack::VersionChecker do
|
|
31
31
|
def assert_version_is(expected_status, latest, current)
|
32
32
|
stub_const('VagrantPlugins::Openstack::VERSION', current)
|
33
33
|
version.stub(:version) { latest }
|
34
|
-
@checker.stub(:
|
35
|
-
expect(@checker).to receive(:
|
34
|
+
@checker.stub(:print_message)
|
35
|
+
expect(@checker).to receive(:print_message) unless expected_status == :latest
|
36
36
|
@checker.check
|
37
37
|
expect(@checker.status).to eq(expected_status)
|
38
38
|
end
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.homepage = 'https://github.com/ggiamarchi/vagrant-openstack-provider'
|
13
13
|
gem.license = 'MIT'
|
14
14
|
|
15
|
-
gem.add_dependency 'json', '
|
15
|
+
gem.add_dependency 'json', '> 2', '< 3'
|
16
16
|
gem.add_dependency 'rest-client', '>= 1.6.0', '< 3.0'
|
17
17
|
gem.add_dependency 'terminal-table', '1.4.5'
|
18
18
|
gem.add_dependency 'sshkey', '1.6.1'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-openstack-provider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Giamarchi
|
@@ -9,28 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '2'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '3
|
23
|
+
version: '3'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- - "
|
28
|
+
- - ">"
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
30
|
+
version: '2'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3
|
33
|
+
version: '3'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rest-client
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|