brocade_vrouter 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/brocade_vrouter/client.rb +5 -3
- data/lib/brocade_vrouter/configuration.rb +9 -8
- 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: ef53271d6a9246b8a7d44226fef34ae5d1ce9c07
|
4
|
+
data.tar.gz: 24a9872b93b4f3525d4de76921fe9f3ca571b411
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 115b06d623eb34a11c73a6364c15358c97715b29a9da748fe48bcd9b26f1cfa8153ede27c036aa428e1ab25c25872e275120ad06a559fafedc7187751b5dbb1d
|
7
|
+
data.tar.gz: 3868121ef70e5fd11fd75af22f5536ab01d81f5d0e61e77f9ca2a8d38dedee1de025fbd3648cd13d17cbe06b17a12cc3217015c2fbd3f98fbb5c9e0cd59a52ec
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module BrocadeVRouter
|
2
2
|
class Client
|
3
|
-
attr_reader :connection
|
3
|
+
attr_reader :connection, :logger
|
4
4
|
|
5
|
-
def initialize(url: nil, connection_options: nil, basic_auth: nil)
|
5
|
+
def initialize(url: nil, connection_options: nil, basic_auth: nil, logger: nil)
|
6
6
|
config = BrocadeVRouter.config
|
7
7
|
url ||= config.url
|
8
8
|
connection_options ||= config.connection_options
|
@@ -12,10 +12,12 @@ module BrocadeVRouter
|
|
12
12
|
f.adapter config.adapter
|
13
13
|
f.basic_auth(*basic_auth) if basic_auth
|
14
14
|
end
|
15
|
+
|
16
|
+
@logger = logger || config.logger
|
15
17
|
end
|
16
18
|
|
17
19
|
def configuration(&blk)
|
18
|
-
@current_conf ||= Configuration.new connection
|
20
|
+
@current_conf ||= Configuration.new connection, logger: logger
|
19
21
|
block_given? ? @current_conf.perform(&blk) : @current_conf
|
20
22
|
end
|
21
23
|
|
@@ -2,11 +2,12 @@ module BrocadeVRouter
|
|
2
2
|
class Configuration
|
3
3
|
CONF_PATH = '/rest/conf'.freeze
|
4
4
|
|
5
|
-
attr_reader :connection, :last_response
|
5
|
+
attr_reader :connection, :last_response, :logger
|
6
6
|
|
7
|
-
def initialize(connection, base_path
|
7
|
+
def initialize(connection, base_path: nil, logger: nil)
|
8
8
|
@connection = connection
|
9
9
|
@base_path = base_path
|
10
|
+
@logger = logger
|
10
11
|
end
|
11
12
|
|
12
13
|
def base_path
|
@@ -73,12 +74,12 @@ module BrocadeVRouter
|
|
73
74
|
|
74
75
|
def handle_response(resp)
|
75
76
|
@last_response = resp
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
|
78
|
+
message = "#{resp.env.method} #{resp.env.url} #{resp.env.status}\n#{resp.body}"
|
79
|
+
logger.info message if logger
|
80
|
+
|
81
|
+
raise RequestError.new message if BrocadeVRouter.config.raise_on_fail && !resp.success?
|
82
|
+
|
82
83
|
resp
|
83
84
|
end
|
84
85
|
|
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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Kosmatov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|