openstack-router 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/openstack-router/parameter/connection.rb +21 -4
- data/lib/openstack-router/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f75a1372ca48807478db771b5cef9e87dcf6692b1d996b83b79a46e1e5e094
|
4
|
+
data.tar.gz: 45c8b6994b400d5f00e812faa71100680dbabb0810284492f84fc77ea0a2d1cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bf430ddb4daced99473fea95d448f9da4877810e3ac26d53a88bd6a30d873d1c8aee9220032831c3a1f1a02203b653973a150bb6e1d9a079a703830691901f9
|
7
|
+
data.tar.gz: a9e6948efba2df9bc0106c16cb50d1d2d3f7a4d56d2acb85fd1960fefbb27bb87e76fb6023cb04b6f19c4042e4770bbae6483b0ffc0f67c7b93801fafeedbacd
|
@@ -21,18 +21,21 @@ module OpenStackRouter
|
|
21
21
|
attr_reader :username
|
22
22
|
attr_reader :api_key
|
23
23
|
attr_reader :tenant
|
24
|
-
attr_reader :
|
24
|
+
attr_reader :tenant_id
|
25
25
|
attr_reader :region
|
26
26
|
|
27
27
|
# The mandatory options needed to be pass in argument at initialization of that class.
|
28
|
-
MANDATORY_OPTIONS = %i[auth_url username api_key
|
28
|
+
MANDATORY_OPTIONS = %i[auth_url username api_key].freeze
|
29
|
+
# Paired mandatory options (means that one of one pair must me present, not the other).
|
30
|
+
PAIRED_MANDATORY_OPTIONS = [%i[tenant tenant_id]].freeze
|
29
31
|
# The options that are not mandatory for this object.
|
30
32
|
OTHER_OPTIONS = %i[region].freeze
|
31
33
|
# Constant containing all the available options.
|
32
|
-
ALL_OPTIONS = (MANDATORY_OPTIONS + OTHER_OPTIONS).freeze
|
34
|
+
ALL_OPTIONS = (MANDATORY_OPTIONS + PAIRED_MANDATORY_OPTIONS.flatten + OTHER_OPTIONS).freeze
|
33
35
|
|
34
36
|
def initialize(options)
|
35
37
|
mandatory_options(options)
|
38
|
+
paired_mandatory_options(options)
|
36
39
|
other_options(options)
|
37
40
|
end
|
38
41
|
|
@@ -68,7 +71,7 @@ module OpenStackRouter
|
|
68
71
|
attr_writer :username
|
69
72
|
attr_writer :api_key
|
70
73
|
attr_writer :tenant
|
71
|
-
attr_writer :
|
74
|
+
attr_writer :tenant_id
|
72
75
|
attr_writer :region
|
73
76
|
|
74
77
|
def mandatory_options(cfg)
|
@@ -83,6 +86,20 @@ module OpenStackRouter
|
|
83
86
|
raise ArgumentError, "Missing keys: #{missing_keys}" unless missing_keys.empty?
|
84
87
|
end
|
85
88
|
|
89
|
+
def paired_mandatory_options(cfg)
|
90
|
+
missing_keys = []
|
91
|
+
PAIRED_MANDATORY_OPTIONS.each do |key1, key2|
|
92
|
+
if cfg.key? key1
|
93
|
+
send("#{key1}=".to_sym, cfg[key1])
|
94
|
+
elsif cfg.key? key2
|
95
|
+
send("#{key2}=".to_sym, cfg[key2])
|
96
|
+
else
|
97
|
+
missing_keys.append([key1, key2])
|
98
|
+
end
|
99
|
+
end
|
100
|
+
raise ArgumentError, "Missing paired keys: #{missing_keys}" unless missing_keys.empty?
|
101
|
+
end
|
102
|
+
|
86
103
|
def other_options(cfg)
|
87
104
|
cfg.each do |key, value|
|
88
105
|
send("#{key}=".to_sym, value) if OTHER_OPTIONS.include?(key)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstack-router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roland Laurès
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-openstack
|