openstack-router 0.1.1 → 0.1.2
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/router.rb +42 -6
- 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: 6e4ca3bc4dc4784bbde2456f6c8f345066529d4c9451885f07c1b20e2094cb41
|
4
|
+
data.tar.gz: 781556f8136ece2e07fdce30788aa9af2be3fb14a005228a3ed0adac96d7dfe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b095cdc56abd579f074f5e2a1566b833b242328715bd2f24c8a4268ae19edf90f44ec607291a1942e52d42a34d28797b9d67195e892e93ceec507b278df4eecc
|
7
|
+
data.tar.gz: 3dcfb962b7edd53cd5ee6f22e39029ec42fd2a92d30ff8cf01f4e2da93d5466c56f492e96c2ab0610e332591917cd2377efef04ebb84918b634128061970da72
|
@@ -38,15 +38,29 @@ module OpenStackRouter
|
|
38
38
|
# at each request. :compute will be converted to 'Compute'.
|
39
39
|
# @param [Symbol] request This is the request you want to launch on the regions' service.
|
40
40
|
# This is a method call, and then must be a Symbol.
|
41
|
+
# @param [...] request_args The remaining arguments are destinated to the request call and will be passed
|
42
|
+
# as is.
|
41
43
|
# @see https://github.com/fog/fog-openstack For more information on available services and requests name
|
42
44
|
#
|
43
|
-
# @return [Hash] The result of each region, the key being the region_name and the value the
|
45
|
+
# @return [Hash] The result of each region, the key being the region_name and the value of the
|
44
46
|
# result of Region#request with the given argument.
|
45
|
-
#
|
46
|
-
|
47
|
+
#
|
48
|
+
# @yield [region_name, answer] Block called for each region that answers
|
49
|
+
# @yieldparam [String] region_name The name of the region for that answer
|
50
|
+
# @yieldparam [Excon::Response] answer The answer to the request.
|
51
|
+
# @yieldreturn ['a] the return of the block is stored in the hash as a value
|
52
|
+
# to the key that will be the region_name.
|
53
|
+
def request_each(service, request, *request_args)
|
47
54
|
# TODO: make the requests to be parallele to no do them sequentialy...
|
48
55
|
Hash[@regions.map do |region|
|
49
|
-
[
|
56
|
+
[
|
57
|
+
region.name,
|
58
|
+
region.request(service, request, *request_args) do |answer|
|
59
|
+
next answer unless block_given?
|
60
|
+
|
61
|
+
yield(region.name, answer)
|
62
|
+
end
|
63
|
+
]
|
50
64
|
end]
|
51
65
|
end
|
52
66
|
|
@@ -69,11 +83,33 @@ module OpenStackRouter
|
|
69
83
|
@rr_circuits[rr_uuid]
|
70
84
|
end
|
71
85
|
|
72
|
-
|
86
|
+
# Run in the given circuit [rr_uuid] the request.
|
87
|
+
# @param [String] rr_uuid The uuid of the usd circuit. It must have been generated with {rr_create}
|
88
|
+
# @param [String | Symbol] service The service you want to interogate
|
89
|
+
# Service name should be capitalized, but by precaution, it is converted to string and capitalized
|
90
|
+
# at each request. :compute will be converted to 'Compute'.
|
91
|
+
# @param [Symbol] request This is the request you want to launch on the regions' service.
|
92
|
+
# This is a method call, and then must be a Symbol.
|
93
|
+
# @param [...] request_args The remaining arguments are destinated to the request call and will be passed
|
94
|
+
# as is.
|
95
|
+
# @see https://github.com/fog/fog-openstack For more information on available services and requests name
|
96
|
+
#
|
97
|
+
# @return ['a] The result of the selected region, the value of the
|
98
|
+
# result of Region#request with the given argument.
|
99
|
+
#
|
100
|
+
# @yield [region_name, answer] Block called over the result of the request.
|
101
|
+
# @yieldparam [String] region_name The name of the region that has been elected to run the request
|
102
|
+
# @yieldparam [Excon::Response] answer The answer to the request.
|
103
|
+
# @yieldreturn ['a] the result value of the block is returned by the method itself.
|
104
|
+
def rr_request(rr_uuid, service, request, *request_args)
|
73
105
|
raise ArgumentError, 'Invalid UUID given' unless @rr_circuits.key?(rr_uuid)
|
74
106
|
|
75
107
|
region = rr_next_region(rr_uuid)
|
76
|
-
region.request(service, request, *region.my_args(request_args, region_names)
|
108
|
+
region.request(service, request, *region.my_args(request_args, region_names)) do |answer|
|
109
|
+
next answer unless block_given?
|
110
|
+
|
111
|
+
yield(region.name, answer)
|
112
|
+
end
|
77
113
|
end
|
78
114
|
|
79
115
|
private
|
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.2
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-openstack
|