File tree Expand file tree Collapse file tree 5 files changed +45
-33
lines changed
Expand file tree Collapse file tree 5 files changed +45
-33
lines changed Original file line number Diff line number Diff line change 1+ # 0.2.0
2+ - move to use newer sequel gem
3+ * this drops support for schema plugin
4+ - refresh other dependencies as well
5+
16# 0.1.10
27 - FIX: check error_status from snmp_response and act based on that
38
Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- corona (0.0.12 )
5- asetus
6- sequel
7- slop
8- snmp
9- sqlite3
4+ corona (0.2.0 )
5+ asetus ( ~> 0.3 )
6+ sequel ( ~> 5.10 )
7+ slop ( ~> 3.6 )
8+ snmp ( ~> 1.2 )
9+ sqlite3 ( ~> 1.4 )
1010
1111GEM
1212 remote: https://rubygems.org/
1313 specs:
14- asetus (0.0.7 )
15- slop
16- sequel (4.9.0 )
17- slop (3.5.0 )
18- snmp (1.1.1 )
19- sqlite3 (1.3.9 )
14+ asetus (0.3.0 )
15+ sequel (5.24.0 )
16+ slop (3.6.0 )
17+ snmp (1.3.2 )
18+ sqlite3 (1.4.1 )
2019
2120PLATFORMS
2221 ruby
2322
2423DEPENDENCIES
2524 corona !
25+
26+ BUNDLED WITH
27+ 2.0.2
Original file line number Diff line number Diff line change 11Gem ::Specification . new do |s |
22 s . name = 'corona'
3- s . version = '0.1.10 '
3+ s . version = '0.2.0 '
44 s . licenses = %w( 'Apache-2.0' )
55 s . platform = Gem ::Platform ::RUBY
66 s . authors = [ 'Saku Ytti' ]
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
1313 s . executables = %w( corona )
1414 s . require_path = 'lib'
1515
16- s . add_runtime_dependency 'sequel' , '~> 4.12 '
17- s . add_runtime_dependency 'sqlite3' , '~> 1.3 '
16+ s . add_runtime_dependency 'sequel' , '~> 5.10 '
17+ s . add_runtime_dependency 'sqlite3' , '~> 1.4 '
1818 s . add_runtime_dependency 'snmp' , '~> 1.2'
19- s . add_runtime_dependency 'slop' , '~> 3.5 '
20- s . add_runtime_dependency 'asetus' , '~> 0.1 '
19+ s . add_runtime_dependency 'slop' , '~> 3.6 '
20+ s . add_runtime_dependency 'asetus' , '~> 0.3 '
2121end
Original file line number Diff line number Diff line change 33 require 'sequel'
44 require 'sqlite3'
55 def initialize
6- Sequel ::Model . plugin :schema
76 @db = Sequel . sqlite ( CFG . db , :max_connections => 1 , :pool_timeout => 60 )
7+ create_table #unless @db.table_exists?(:devices)
88 require_relative 'model'
99 end
1010
@@ -27,5 +27,25 @@ def old ip, oid_sysName
2727 sysName = Device [ :oid_sysName => oid_sysName ]
2828 [ ip , sysName ]
2929 end
30+
31+ private
32+
33+ def create_table
34+ @db . create_table? :devices do
35+ primary_key :id
36+ String :ip
37+ String :ptr
38+ String :model
39+ String :oid_ifDescr
40+ Boolean :active
41+ Time :first_seen
42+ Time :last_seen
43+ String :oid_sysName
44+ String :oid_sysLocation
45+ String :oid_sysDescr
46+ String :oid_sysObjectID
47+ end
48+ end
49+
3050 end
3151end
Original file line number Diff line number Diff line change 11module Corona
22 class DB
33 class Device < Sequel ::Model
4- set_schema do
5- primary_key :id
6- String :ip
7- String :ptr
8- String :model
9- String :oid_ifDescr
10- Boolean :active
11- Time :first_seen
12- Time :last_seen
13- String :oid_sysName
14- String :oid_sysLocation
15- String :oid_sysDescr
16- String :oid_sysObjectID
17- end
18- create_table unless table_exists?
194 end
205 end
216end
You can’t perform that action at this time.
0 commit comments