brocade_vrouter 0.4.6 → 0.4.7
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/brocade_vrouter/configuration.rb +24 -18
- data/lib/brocade_vrouter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82e2c6f4a465839111b3858ffc1d4d46d1c91410
|
4
|
+
data.tar.gz: 0ea9c6b48bfc779ad9239bce17602fdaa1e6e6a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5bec02a57edb2dc30c9b110d292b2db92367a994f1be70caf9eebeb791265bcaa1a0763cb831f377cf2539da3b76f3d81a50eed2fd5152319fda4c6d7351edb
|
7
|
+
data.tar.gz: f96f80e618fa36c90940cb85ccb977e68c934b322ef036ee062c4164612a1968287328496b4ec2fed212b1333e19bce58f99927b86acb1a717c4940007a14ad3
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module BrocadeVRouter
|
4
4
|
class Configuration
|
5
|
+
ParseError = Class.new(StandardError)
|
6
|
+
|
5
7
|
LTSEP = ' '.freeze
|
6
8
|
OBRKT = '{'.freeze
|
7
9
|
CBRKT = '}'.freeze
|
@@ -23,26 +25,30 @@ module BrocadeVRouter
|
|
23
25
|
def parse_lines!(lines, path)
|
24
26
|
conf = {}
|
25
27
|
while lines.any?
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
value = literals.join(LTSEP).tr('\'"', '')
|
40
|
-
if array_field?(path, name)
|
41
|
-
conf[name] ||= []
|
42
|
-
conf[name] << value
|
28
|
+
begin
|
29
|
+
literals = lines.shift.split(LTSEP)
|
30
|
+
name = literals.shift
|
31
|
+
|
32
|
+
if name == CBRKT
|
33
|
+
return conf
|
34
|
+
elsif literals.last == OBRKT
|
35
|
+
if literals.first != OBRKT
|
36
|
+
conf[name] ||= {}
|
37
|
+
conf[name][literals.first] = parse_lines! lines, path + [name, literals.first]
|
38
|
+
else
|
39
|
+
conf[name] = parse_lines! lines, path + [name]
|
40
|
+
end
|
43
41
|
else
|
44
|
-
|
42
|
+
value = literals.join(LTSEP).tr('\'"', '')
|
43
|
+
if array_field?(path, name)
|
44
|
+
conf[name] ||= []
|
45
|
+
conf[name] << value
|
46
|
+
else
|
47
|
+
conf[name] = value.empty? ? nil : value
|
48
|
+
end
|
45
49
|
end
|
50
|
+
rescue StandardError => e
|
51
|
+
raise ParseError.new("#{e.message}: #{literals}")
|
46
52
|
end
|
47
53
|
end
|
48
54
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brocade_vrouter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Kosmatov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|