lorj 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 913a046318c32edd50058f113100fed25d93075d
4
- data.tar.gz: 58fb06cb60adfc5b01682f9c966d23dc82b29ae6
3
+ metadata.gz: cbe0901bbfa07d90519c83339a77a0e283e205d3
4
+ data.tar.gz: 813357cfb6091233c16d726148f31745a33bd358
5
5
  SHA512:
6
- metadata.gz: c5839c30daa322cf69478379d1dc5282eded2fdb34e6d1f0de7a37d8674e25bddc5e850a386467e0573eed6fc56b11a83868d9289441897c763a518d44ec9901
7
- data.tar.gz: 8128e5644c561b4fd66456e917cfe5cc3a3c51da5c52b581b352adaa3da8f0714a69a745ec37e982c58bbebccaf849c9399526b4c0a30afbe8764143a77f7020
6
+ metadata.gz: dcd5cf66499c650e34f0551c43754fb162a6b6dc63dcd0aabec518bfef20d3649b3190ba6b561ef0de70d51b52be1ea6d679d97192496a92318ebc47fa90b66d
7
+ data.tar.gz: ceb1b16973daa3daaf3093f6093c5aa28d6f4e20639e2afa1133da21d931d4e3acbfd6bd7f6bd6daba2fcce068bbb7b42bad1e6fcc6f6a24f3e049503f495936
@@ -32,9 +32,13 @@ class CloudProcess
32
32
  router_name = hParams[:router_name]
33
33
  end
34
34
 
35
+ _get_router(router_name, sub_net_obj, hParams)
36
+ end
37
+
38
+ def _get_router(router_name, sub_net_obj, hParams)
35
39
  router_port = get_router_interface_attached(:port, hParams)
36
40
 
37
- if router_port.length == 0
41
+ if router_port.nil? || router_port.length == 0
38
42
  # Trying to get router
39
43
  router = get_router(router_name)
40
44
  router = create_router(router_name) if router.empty?
@@ -188,27 +192,36 @@ class CloudProcess
188
192
  end
189
193
  end
190
194
 
195
+ # Function to get the router ID in the network
196
+ # from the list of routers found.
197
+ # Query ports devices.
191
198
  def get_router_interface_attached(sCloudObj, hParams)
192
199
  name = hParams[:network, :name]
193
200
  PrcLib.state("Searching for router port attached to the network '%s'", name)
194
- begin
195
- # Searching for router port attached
196
- #################
197
- query = { :network_id => hParams[
198
- :network, :id],
199
- :device_owner => 'network:router_interface' }
200
- info = {
201
- :notfound => "No router %s for network '%s' found",
202
- :checkmatch => 'Found 1 router %s. '\
203
- "Checking exact match for network '%s'.",
204
- :nomatch => "No router %s for network '%s' match",
205
- :found => "Found router %s ID %s attached to network '#{name}'.",
206
- :more => "Found several router %s. Searching for network '%s'.",
207
- :items => [:id]
208
- }
209
- query_single(sCloudObj, query, name, info)
210
- rescue => e
211
- PrcLib.error("%s\n%s", e.message, e.backtrace.join("\n"))
201
+ routers = controller_query(:router, {})
202
+ routers.each do |router|
203
+ begin
204
+ router_name = router[:name]
205
+ # Searching for router port attached
206
+ #################
207
+ query = { :network_id => hParams[:network, :id],
208
+ :device_id => router[:id] }
209
+ info = {
210
+ :notfound => "Network '#{name}' not attached to router "\
211
+ "'#{router_name}'",
212
+ :checkmatch => 'Found 1 router %s. '\
213
+ "Checking exact match for network '%s'.",
214
+ :nomatch => "No router %s for network '%s' match",
215
+ :found => "Found router %s ID (#{router_name}) %s attached to "\
216
+ "network '#{name}'.",
217
+ :more => "Found several router %s. Searching for network '%s'.",
218
+ :items => [:id]
219
+ }
220
+ interfaces = query_single(sCloudObj, query, name, info)
221
+ return interfaces unless interfaces.length == 0
222
+ rescue => e
223
+ PrcLib.error("%s\n%s", e.message, e.backtrace.join("\n"))
224
+ end
212
225
  end
213
226
  end
214
227
 
data/lib/lorj/version.rb CHANGED
@@ -16,5 +16,5 @@
16
16
 
17
17
  # Lorj version
18
18
  module Lorj
19
- VERSION = '1.0.6'
19
+ VERSION = '1.0.7'
20
20
  end
@@ -316,14 +316,18 @@ class OpenstackController
316
316
  oControlerObject.class,
317
317
  oControlerObject.class.attributes unless
318
318
  oControlerObject.class.attributes.include?(key[0])
319
-
320
319
  return attributes.rh_get(key) if attributes.rh_exist?(key)
321
- return oControlerObject.send(key[0]) if key.length == 1
322
- oControlerObject.send(key[0]).rh_get(key[1..-1])
320
+ _get_instance_attr(oControlerObject, key)
323
321
  end
324
322
  rescue => e
325
323
  controller_error "==>Unable to map '%s'. %s", key, e.message
326
324
  end
325
+
326
+ def _get_instance_attr(oControlerObject, key)
327
+ return nil if oControlerObject.send(key[0]).nil?
328
+ return oControlerObject.send(key[0]) if key.length == 1
329
+ oControlerObject.send(key[0]).rh_get(key[1..-1])
330
+ end
327
331
  end
328
332
 
329
333
  # Following class describe how FORJ should handle Openstack Cloud objects.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lorj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - forj team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-19 00:00:00.000000000 Z
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler