brocade_vrouter 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ebdaf31f73486d7a464dca110e6479a1815f62c
4
- data.tar.gz: 49caa01e9e6198e5822578be281148dee31a4564
3
+ metadata.gz: 27e8f859934fb6b76803b2ccd907db3143b1fc36
4
+ data.tar.gz: bb175b3a07aeba1cfd184004bb5d5df3dec191cc
5
5
  SHA512:
6
- metadata.gz: 908a44936e03163368a5b72694be50c839740d1a449eec4afe71239bd41797dddbb305a16385e6f0ab13b8051dd07141963c08c7cbfdaf84eaad69e423b21e9f
7
- data.tar.gz: 692f9bd9506ae9c95e3de77c90ea82a2a1a7b382535b22f592f93c4054eb0632061f2b9dc8a0a6712b753935f1cb59a93fc4a74668f2a6a6f834e5eb16ad371f
6
+ metadata.gz: 64f99f9a1bc26f324b064b23060d2cb0001cb4166ea8b3e9058ea1453673f0b9e1ccf38775781e52dc3f5d4b2175cb2fa220b0263827d08771aa9aebae5f1289
7
+ data.tar.gz: c1997ae826cd49da9e8c05e294e0892e2a042296285f26a04768223b72d654cb27e5a7b4ea9ba368dfb7d93c502fe57daa0eed80d24b0f3473088567758fa0ef
@@ -25,7 +25,6 @@ module BrocadeVRouter
25
25
  while lines.any?
26
26
  literals = lines.shift.split(LTSEP)
27
27
  name = literals.shift
28
- name = literals.shift if name == path.last
29
28
 
30
29
  if name == CBRKT
31
30
  return conf
@@ -38,9 +38,17 @@ module BrocadeVRouter
38
38
  end
39
39
 
40
40
  def get
41
- res = handle_response connection.post '/rest/op/show/configuration'
42
- res = handle_response connection.get "/#{res.headers['location']}" if res.success?
43
- Configuration.new(res.body).to_h if res.success?
41
+ path = 'rest/op/show/configuration'
42
+ handle_request :post, path
43
+ resp = handle_response connection.post "/#{path}"
44
+
45
+ return unless resp.success?
46
+
47
+ path = "#{resp.headers['location']}"
48
+ handle_request :get, path
49
+ resp = handle_response connection.get "/#{path}"
50
+
51
+ Configuration.new(resp.body).to_h if resp.success?
44
52
  end
45
53
 
46
54
  def delete(paths = nil, &blk)
@@ -102,11 +110,11 @@ module BrocadeVRouter
102
110
 
103
111
  message = "< #{resp.env.method.upcase} #{resp.env.url} #{resp.env.status}\n#{resp.body}"
104
112
 
105
- if !resp.success?
113
+ if resp.success?
114
+ logger.info message if logger
115
+ else
106
116
  logger.warn message if logger
107
117
  raise RequestError.new message if raise_on_fail?
108
- else
109
- logger.info message if logger
110
118
  end
111
119
 
112
120
  resp
@@ -118,11 +126,8 @@ module BrocadeVRouter
118
126
 
119
127
  def build_paths(paths, &blk)
120
128
  paths = Array(paths)
121
- if block_given?
122
- paths.map { |p| PathBuilder.new(@context, p, &blk).to_a }.flatten
123
- else
124
- paths
125
- end
129
+ return paths unless block_given?
130
+ paths.map { |p| PathBuilder.new(@context, p, &blk).to_a }.flatten
126
131
  end
127
132
  end
128
133
  end
@@ -1,3 +1,3 @@
1
1
  module BrocadeVRouter
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brocade_vrouter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Kosmatov