logstash-filter-wkt_repair 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/filters/wkt_repair.rb +22 -20
- data/logstash-filter-wkt_repair.gemspec +1 -1
- data/spec/filters/wkt_repair_spec.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be14b161e3a0c66926ad60399614e447133368e26bb6818406007f8734823f0e
|
4
|
+
data.tar.gz: 0ab82484912b7b1a4bb498108931a93408c3fd81b9c2b599a2affe3a1360297c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 449d144e38bbaa76120450c7d4243aa77541d4545d4269adb8db8aecdbafaf4bfa73fe0f3714268d7a2af3449aace7dfab13ac31744a89b18de0bbc6b4be755b
|
7
|
+
data.tar.gz: f6752e5bf97463f3757e90d582e779913f3452d9276e03d81852e0334b1c673b97c3114c051dbd88d49522e8519a47cfa667059e48ee7961e172e05b0887cf7d
|
@@ -33,29 +33,31 @@ class LogStash::Filters::WktRepair < LogStash::Filters::Base
|
|
33
33
|
random_hex = SecureRandom.hex(10)
|
34
34
|
temp_file = "temp-wkt_#{event_uuid}_#{random_hex}.txt"
|
35
35
|
|
36
|
-
|
37
|
-
IO.write(temp_file, wkt)
|
38
|
-
|
39
|
-
wkt_repair_cmd = "prepair -f #{temp_file}"
|
40
|
-
stdout, stderr, status = Open3.capture3("#{wkt_repair_cmd}")
|
41
|
-
|
42
|
-
if status.success?
|
43
|
-
event.set(@target, stdout.strip)
|
44
|
-
else
|
45
|
-
@logger.error("WKT Repair Error: #{stderr}")
|
46
|
-
@logger.error("WKT Repair Output Message: #{stdout}")
|
47
|
-
@tag_on_failure.each { |tag| event.tag(tag) }
|
48
|
-
end
|
49
|
-
rescue Exception => e
|
50
|
-
@logger.error("WKT Repair Exception", :exception => e)
|
51
|
-
@tag_on_failure.each { |tag| event.tag(tag) }
|
52
|
-
ensure
|
36
|
+
unless wkt.nil?
|
53
37
|
begin
|
54
|
-
|
55
|
-
|
38
|
+
IO.write(temp_file, wkt)
|
39
|
+
|
40
|
+
wkt_repair_cmd = "prepair -f #{temp_file}"
|
41
|
+
stdout, stderr, status = Open3.capture3("#{wkt_repair_cmd}")
|
42
|
+
|
43
|
+
if (status.success? && !stdout.nil?)
|
44
|
+
event.set(@target, stdout.strip)
|
45
|
+
else
|
46
|
+
@logger.error("WKT Repair Error: #{stderr}")
|
47
|
+
@logger.error("WKT Repair Output Message: #{stdout}")
|
48
|
+
@tag_on_failure.each { |tag| event.tag(tag) }
|
56
49
|
end
|
57
50
|
rescue Exception => e
|
58
|
-
@logger.error("WKT Repair Exception
|
51
|
+
@logger.error("WKT Repair Exception", :exception => e, :stacktrace => e.backtrace.join("\n"))
|
52
|
+
@tag_on_failure.each { |tag| event.tag(tag) }
|
53
|
+
ensure
|
54
|
+
begin
|
55
|
+
if File.file?(temp_file)
|
56
|
+
File.delete(temp_file)
|
57
|
+
end
|
58
|
+
rescue Exception => e
|
59
|
+
@logger.error("WKT Repair Exception in ensure block", :exception => e, :stacktrace => e.backtrace.join("\n"))
|
60
|
+
end
|
59
61
|
end
|
60
62
|
end
|
61
63
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-wkt_repair'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.11'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'Logstash filter to repair a WKT shape data.'
|
6
6
|
s.description = 'It takes ambigous or ill-defined polygons and returns a coherent and clearly defined output.'
|
@@ -41,3 +41,22 @@ describe LogStash::Filters::WktRepair do
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
describe LogStash::Filters::WktRepair do
|
46
|
+
describe "Ignore Nil WKT" do
|
47
|
+
let(:config) do <<-CONFIG
|
48
|
+
filter {
|
49
|
+
wkt_repair {
|
50
|
+
source => "geometry"
|
51
|
+
target => "geometry"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
CONFIG
|
55
|
+
end
|
56
|
+
|
57
|
+
sample("geometry" => nil) do
|
58
|
+
expect(subject).to include("geometry")
|
59
|
+
expect(subject.get('geometry')).to be_nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-wkt_repair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Silver Ibenye
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|