vayacondios-server 0.2.2 → 0.2.4
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.
- data/Gemfile +2 -0
- data/lib/vayacondios/client/itemset.rb +1 -1
- data/lib/vayacondios/client/legacy_switch.rb +46 -0
- data/lib/vayacondios/server/legacy_switch.rb +46 -0
- data/lib/vayacondios/server/model/itemset_document.rb +1 -1
- data/lib/vayacondios/version.rb +1 -1
- data/spec/client/itemset_legacy_spec.rb +1 -1
- metadata +5 -3
data/Gemfile
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'gorillib/logger/log'
|
2
|
+
|
3
|
+
class Vayacondios
|
4
|
+
# Are we operating on JSON Hashes (Vayacondios) or on JSON arrays
|
5
|
+
# (Vayacondios Legacy)? These classes determine which to use.
|
6
|
+
|
7
|
+
class StandardContentsHandler
|
8
|
+
def wrap_contents(contents) {contents: contents} end
|
9
|
+
def extract_contents(document) document['contents'] end
|
10
|
+
def extract_response(document) document['contents'] end
|
11
|
+
def proper_request(document)
|
12
|
+
document.is_a? Hash and document.fetch('_json', {}).is_a? Hash
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class LegacyContentsHandler
|
17
|
+
def wrap_contents(contents) contents end
|
18
|
+
def extract_contents(document) document.fetch('_json', {}) end
|
19
|
+
def extract_response(document) document end
|
20
|
+
def proper_request(document)
|
21
|
+
document.is_a? Array or document.fetch('_json', {}).is_a? Array
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
@@legacy_switch = nil
|
26
|
+
|
27
|
+
def self.legacy_switch
|
28
|
+
legacy_mode_on = Settings[:vayacondios][:legacy]
|
29
|
+
if @@legacy_switch.nil?
|
30
|
+
@@legacy_switch = get_legacy_switch(legacy_mode_on)
|
31
|
+
Log.info("using #{legacy_mode_on ? 'legacy' : 'standard'} mode")
|
32
|
+
end
|
33
|
+
@@legacy_switch
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.force_legacy_mode on
|
37
|
+
@@legacy_switch = get_legacy_switch on
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def self.get_legacy_switch on
|
43
|
+
(on ? LegacyContentsHandler : StandardContentsHandler).new
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'gorillib/logger/log'
|
2
|
+
|
3
|
+
class Vayacondios
|
4
|
+
# Are we operating on JSON Hashes (Vayacondios) or on JSON arrays
|
5
|
+
# (Vayacondios Legacy)? These classes determine which to use.
|
6
|
+
|
7
|
+
class StandardContentsHandler
|
8
|
+
def wrap_contents(contents) {contents: contents} end
|
9
|
+
def extract_contents(document) document['contents'] end
|
10
|
+
def extract_response(document) document['contents'] end
|
11
|
+
def proper_request(document)
|
12
|
+
document.is_a? Hash and document.fetch('_json', {}).is_a? Hash
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class LegacyContentsHandler
|
17
|
+
def wrap_contents(contents) contents end
|
18
|
+
def extract_contents(document) document.fetch('_json', {}) end
|
19
|
+
def extract_response(document) document end
|
20
|
+
def proper_request(document)
|
21
|
+
document.is_a? Array or document.fetch('_json', {}).is_a? Array
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
@@legacy_switch = nil
|
26
|
+
|
27
|
+
def self.legacy_switch
|
28
|
+
legacy_mode_on = Settings[:vayacondios][:legacy]
|
29
|
+
if @@legacy_switch.nil?
|
30
|
+
@@legacy_switch = get_legacy_switch(legacy_mode_on)
|
31
|
+
Log.info("using #{legacy_mode_on ? 'legacy' : 'standard'} mode")
|
32
|
+
end
|
33
|
+
@@legacy_switch
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.force_legacy_mode on
|
37
|
+
@@legacy_switch = get_legacy_switch on
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def self.get_legacy_switch on
|
43
|
+
(on ? LegacyContentsHandler : StandardContentsHandler).new
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
data/lib/vayacondios/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vayacondios-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- lib/vayacondios/client/cube_client.rb
|
209
209
|
- lib/vayacondios/client/http_client.rb
|
210
210
|
- lib/vayacondios/client/itemset.rb
|
211
|
+
- lib/vayacondios/client/legacy_switch.rb
|
211
212
|
- lib/vayacondios/client/notifier.rb
|
212
213
|
- lib/vayacondios/client/zabbix_client.rb
|
213
214
|
- lib/vayacondios/legacy_switch.rb
|
@@ -216,6 +217,7 @@ files:
|
|
216
217
|
- lib/vayacondios/server/handlers/config_handler.rb
|
217
218
|
- lib/vayacondios/server/handlers/event_handler.rb
|
218
219
|
- lib/vayacondios/server/handlers/itemset_handler.rb
|
220
|
+
- lib/vayacondios/server/legacy_switch.rb
|
219
221
|
- lib/vayacondios/server/model/config_document.rb
|
220
222
|
- lib/vayacondios/server/model/document.rb
|
221
223
|
- lib/vayacondios/server/model/event_document.rb
|
@@ -277,7 +279,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
277
279
|
version: '0'
|
278
280
|
segments:
|
279
281
|
- 0
|
280
|
-
hash: -
|
282
|
+
hash: -3470064849041831815
|
281
283
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
282
284
|
none: false
|
283
285
|
requirements:
|
@@ -286,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
286
288
|
version: '0'
|
287
289
|
segments:
|
288
290
|
- 0
|
289
|
-
hash: -
|
291
|
+
hash: -3470064849041831815
|
290
292
|
requirements: []
|
291
293
|
rubyforge_project:
|
292
294
|
rubygems_version: 1.8.25
|