oxidized 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +12 -0
- data/.rubocop_todo.yml +20 -17
- data/CHANGELOG.md +5 -0
- data/Dockerfile +1 -1
- data/README.md +4 -3
- data/docs/Supported-OS-Types.md +2 -0
- data/lib/oxidized/hook.rb +1 -1
- data/lib/oxidized/hook/githubrepo.rb +1 -1
- data/lib/oxidized/input/cli.rb +11 -0
- data/lib/oxidized/input/ssh.rb +0 -13
- data/lib/oxidized/input/telnet.rb +1 -7
- data/lib/oxidized/manager.rb +36 -43
- data/lib/oxidized/model/br6910.rb +0 -1
- data/lib/oxidized/model/comware.rb +3 -0
- data/lib/oxidized/model/edgecos.rb +1 -8
- data/lib/oxidized/model/junos.rb +1 -4
- data/lib/oxidized/node.rb +9 -5
- data/lib/oxidized/node/stats.rb +6 -0
- data/lib/oxidized/nodes.rb +1 -1
- data/lib/oxidized/version.rb +2 -2
- data/lib/oxidized/worker.rb +1 -0
- data/oxidized.gemspec +1 -2
- metadata +5 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82b0526060e394b00d65a0910bc943c6ab0e7d297e10af5bba036b98d69a592c
|
4
|
+
data.tar.gz: d3ff1a990a0cd666313e3027a59148e7e1e3dc5cef403205a136a74510655718
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ba909c41f9e35f02ba8c8429aaad7997c1837871d7d7c16097330c8f96a2d642106597a4289bdefb839540f17d080a7e3bfbd669c289f0bce693c24e4a58219
|
7
|
+
data.tar.gz: ffc0b7476888718ab44ee1372e247107c33092396478d0fcb91a7af7e3361f3de45f072184abd70f25f42d3a4ed658bf1d666c43d57c0a77dcf8e669ec7ab335
|
@@ -0,0 +1,12 @@
|
|
1
|
+
## Pre-Request Checklist
|
2
|
+
<!-- Not all items apply to each PR, but a great PR addresses all applicable items. -->
|
3
|
+
|
4
|
+
- [ ] Passes rubocop code analysis (try `rubocop --auto-correct`)
|
5
|
+
- [ ] Tests added or adapted (try `rake test`)
|
6
|
+
- [ ] Changes are reflected in the documentation
|
7
|
+
- [ ] User-visible changes appended to [CHANGELOG.md](/CHANGELOG.md)
|
8
|
+
|
9
|
+
## Description
|
10
|
+
<!-- Describe your changes here. -->
|
11
|
+
|
12
|
+
<!-- Add a text similar to "Closes issue #" if this PR relates to an existing issue. -->
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2018-06-
|
3
|
+
# on 2018-06-08 09:41:49 +0200 using RuboCop version 0.57.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -19,7 +19,7 @@ Lint/AmbiguousBlockAssociation:
|
|
19
19
|
- 'lib/oxidized/model/model.rb'
|
20
20
|
- 'lib/oxidized/model/nos.rb'
|
21
21
|
|
22
|
-
# Offense count:
|
22
|
+
# Offense count: 684
|
23
23
|
Lint/AmbiguousRegexpLiteral:
|
24
24
|
Enabled: false
|
25
25
|
|
@@ -68,11 +68,10 @@ Lint/ShadowingOuterLocalVariable:
|
|
68
68
|
- 'lib/oxidized/model/fortios.rb'
|
69
69
|
- 'lib/oxidized/model/planet.rb'
|
70
70
|
|
71
|
-
# Offense count:
|
71
|
+
# Offense count: 7
|
72
72
|
Lint/UnderscorePrefixedVariableName:
|
73
73
|
Exclude:
|
74
74
|
- 'lib/oxidized/input/cli.rb'
|
75
|
-
- 'lib/oxidized/manager.rb'
|
76
75
|
- 'lib/oxidized/model/model.rb'
|
77
76
|
- 'lib/oxidized/nodes.rb'
|
78
77
|
|
@@ -115,7 +114,7 @@ Lint/Void:
|
|
115
114
|
Exclude:
|
116
115
|
- 'lib/oxidized/model/voss.rb'
|
117
116
|
|
118
|
-
# Offense count:
|
117
|
+
# Offense count: 64
|
119
118
|
Metrics/AbcSize:
|
120
119
|
Max: 84
|
121
120
|
|
@@ -138,7 +137,7 @@ Metrics/ClassLength:
|
|
138
137
|
Metrics/CyclomaticComplexity:
|
139
138
|
Max: 28
|
140
139
|
|
141
|
-
# Offense count:
|
140
|
+
# Offense count: 55
|
142
141
|
# Configuration parameters: CountComments.
|
143
142
|
Metrics/MethodLength:
|
144
143
|
Max: 76
|
@@ -206,6 +205,12 @@ Performance/Casecmp:
|
|
206
205
|
Exclude:
|
207
206
|
- 'lib/oxidized/manager.rb'
|
208
207
|
|
208
|
+
# Offense count: 1
|
209
|
+
# Cop supports --auto-correct.
|
210
|
+
Performance/InefficientHashSearch:
|
211
|
+
Exclude:
|
212
|
+
- 'lib/oxidized/node.rb'
|
213
|
+
|
209
214
|
# Offense count: 57
|
210
215
|
# Cop supports --auto-correct.
|
211
216
|
Performance/RedundantMatch:
|
@@ -257,7 +262,7 @@ Style/Alias:
|
|
257
262
|
- 'lib/oxidized/node.rb'
|
258
263
|
- 'lib/oxidized/nodes.rb'
|
259
264
|
|
260
|
-
# Offense count:
|
265
|
+
# Offense count: 47
|
261
266
|
# Cop supports --auto-correct.
|
262
267
|
# Configuration parameters: EnforcedStyle.
|
263
268
|
# SupportedStyles: always, conditionals
|
@@ -337,7 +342,7 @@ Style/ConditionalAssignment:
|
|
337
342
|
- 'lib/oxidized/hook/githubrepo.rb'
|
338
343
|
- 'lib/oxidized/model/model.rb'
|
339
344
|
|
340
|
-
# Offense count:
|
345
|
+
# Offense count: 153
|
341
346
|
Style/Documentation:
|
342
347
|
Enabled: false
|
343
348
|
|
@@ -412,7 +417,7 @@ Style/LineEndConcatenation:
|
|
412
417
|
Exclude:
|
413
418
|
- 'lib/oxidized/hook.rb'
|
414
419
|
|
415
|
-
# Offense count:
|
420
|
+
# Offense count: 142
|
416
421
|
# Cop supports --auto-correct.
|
417
422
|
# Configuration parameters: EnforcedStyle.
|
418
423
|
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
|
@@ -485,7 +490,7 @@ Style/NumericPredicate:
|
|
485
490
|
- 'lib/oxidized/nodes.rb'
|
486
491
|
- 'lib/oxidized/worker.rb'
|
487
492
|
|
488
|
-
# Offense count:
|
493
|
+
# Offense count: 2
|
489
494
|
# Cop supports --auto-correct.
|
490
495
|
Style/OrAssignment:
|
491
496
|
Exclude:
|
@@ -503,7 +508,7 @@ Style/ParallelAssignment:
|
|
503
508
|
|
504
509
|
# Offense count: 4
|
505
510
|
# Cop supports --auto-correct.
|
506
|
-
# Configuration parameters: AllowSafeAssignment.
|
511
|
+
# Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions.
|
507
512
|
Style/ParenthesesAroundCondition:
|
508
513
|
Exclude:
|
509
514
|
- 'lib/oxidized/model/ios.rb'
|
@@ -534,12 +539,11 @@ Style/Proc:
|
|
534
539
|
Exclude:
|
535
540
|
- 'lib/oxidized/hook/githubrepo.rb'
|
536
541
|
|
537
|
-
# Offense count:
|
542
|
+
# Offense count: 9
|
538
543
|
# Cop supports --auto-correct.
|
539
544
|
Style/RedundantBegin:
|
540
545
|
Exclude:
|
541
546
|
- 'lib/oxidized/input/telnet.rb'
|
542
|
-
- 'lib/oxidized/manager.rb'
|
543
547
|
- 'lib/oxidized/output/git.rb'
|
544
548
|
- 'lib/oxidized/output/gitcrypt.rb'
|
545
549
|
|
@@ -698,17 +702,16 @@ Style/WordArray:
|
|
698
702
|
EnforcedStyle: percent
|
699
703
|
MinSize: 3
|
700
704
|
|
701
|
-
# Offense count:
|
705
|
+
# Offense count: 3
|
702
706
|
# Cop supports --auto-correct.
|
703
707
|
Style/ZeroLengthPredicate:
|
704
708
|
Exclude:
|
705
709
|
- 'lib/oxidized/core.rb'
|
706
|
-
- 'lib/oxidized/input/telnet.rb'
|
707
710
|
- 'lib/oxidized/model/ciscosmb.rb'
|
708
711
|
- 'lib/oxidized/output/git.rb'
|
709
712
|
|
710
|
-
# Offense count:
|
713
|
+
# Offense count: 306
|
711
714
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
712
715
|
# URISchemes: http, https
|
713
716
|
Metrics/LineLength:
|
714
|
-
Max:
|
717
|
+
Max: 193
|
data/CHANGELOG.md
CHANGED
data/Dockerfile
CHANGED
@@ -23,7 +23,7 @@ LABEL maintainer="Samer Abdel-Hafez <sam@arahant.net>"
|
|
23
23
|
|
24
24
|
# set up dependencies for the build process
|
25
25
|
RUN apt-get -yq update && \
|
26
|
-
apt-get -yq install ruby2.3 ruby2.3-dev libsqlite3-dev libssl-dev pkg-config make cmake libssh2-1-dev git g++ libffi-dev ruby-bundler
|
26
|
+
apt-get -yq install ruby2.3 ruby2.3-dev libsqlite3-dev libssl-dev pkg-config make cmake libssh2-1-dev git g++ libffi-dev ruby-bundler libicu-dev
|
27
27
|
|
28
28
|
# upgrade libssh2 to self-built backport from stage 1
|
29
29
|
COPY --from=libssh2-backport \
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Oxidized
|
2
2
|
[![Build Status](https://api.travis-ci.com/ytti/oxidized.svg)](https://travis-ci.com/ytti/oxidized)
|
3
3
|
[![codecov.io](https://codecov.io/gh/ytti/oxidized/coverage.svg?branch=master)](https://codecov.io/gh/ytti/oxidized?branch=master)
|
4
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5a90cb22db6a4d5ea23ad0dfb53fe03a)](https://www.codacy.com/app/ytti/oxidized?utm_source=github.com&utm_medium=referral&utm_content=ytti/oxidized&utm_campaign=Badge_Grade)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/ytti/oxidized/badges/gpa.svg)](https://codeclimate.com/github/ytti/oxidized)
|
5
6
|
[![Gem Version](https://badge.fury.io/rb/oxidized.svg)](http://badge.fury.io/rb/oxidized)
|
6
7
|
[![Join the chat at https://gitter.im/oxidized/Lobby](https://badges.gitter.im/oxidized/Lobby.svg)](https://gitter.im/oxidized/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -78,7 +79,7 @@ Check out the [Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU#t=3h
|
|
78
79
|
Install all required packages and gems.
|
79
80
|
|
80
81
|
```shell
|
81
|
-
apt-get install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev
|
82
|
+
apt-get install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev libicu-dev
|
82
83
|
gem install oxidized
|
83
84
|
gem install oxidized-script oxidized-web # if you don't install oxidized-web, make sure you remove "rest" from your config
|
84
85
|
```
|
@@ -88,13 +89,13 @@ gem install oxidized-script oxidized-web # if you don't install oxidized-web, ma
|
|
88
89
|
On CentOS 6 / RHEL 6, install Ruby 2.0 or greater (for Ruby 2.1.2 installation instructions see [Installing Ruby 2.1.2 using RVM](#installing-ruby-212-using-rvm)), then install Oxidized dependencies
|
89
90
|
|
90
91
|
```shell
|
91
|
-
yum install cmake sqlite-devel openssl-devel libssh2-devel
|
92
|
+
yum install cmake sqlite-devel openssl-devel libssh2-devel libicu-devel
|
92
93
|
```
|
93
94
|
|
94
95
|
RHEL 7 / CentOS 7 will work out of the box with the following package list:
|
95
96
|
|
96
97
|
```shell
|
97
|
-
yum install cmake sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel
|
98
|
+
yum install cmake sqlite-devel openssl-devel libssh2-devel ruby gcc ruby-devel libicu-devel gcc-c++
|
98
99
|
```
|
99
100
|
|
100
101
|
Now let's install oxidized via Rubygems:
|
data/docs/Supported-OS-Types.md
CHANGED
data/lib/oxidized/hook.rb
CHANGED
@@ -37,7 +37,7 @@ module Oxidized
|
|
37
37
|
"unknown event #{event}, available: #{Events.join ','}"
|
38
38
|
end
|
39
39
|
|
40
|
-
Oxidized.mgr.add_hook hook_type
|
40
|
+
Oxidized.mgr.add_hook(hook_type) or raise("cannot load hook '#{hook_type}', not found")
|
41
41
|
begin
|
42
42
|
hook = Oxidized.mgr.hook.fetch(hook_type).new
|
43
43
|
rescue KeyError
|
data/lib/oxidized/input/cli.rb
CHANGED
@@ -51,6 +51,17 @@ module Oxidized
|
|
51
51
|
def password re = /^Password/
|
52
52
|
@password or @password = re
|
53
53
|
end
|
54
|
+
|
55
|
+
def login
|
56
|
+
match_re = [@node.prompt]
|
57
|
+
match_re << @username if @username
|
58
|
+
match_re << @password if @password
|
59
|
+
until (match = expect(match_re)) == @node.prompt
|
60
|
+
cmd(@node.auth[:username], nil) if match == @username
|
61
|
+
cmd(@node.auth[:password], nil) if match == @password
|
62
|
+
match_re.delete match
|
63
|
+
end
|
64
|
+
end
|
54
65
|
end
|
55
66
|
end
|
56
67
|
end
|
data/lib/oxidized/input/ssh.rb
CHANGED
@@ -118,19 +118,6 @@ module Oxidized
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
# some models have SSH auth or terminal auth based on version of code
|
122
|
-
# if SSH is configured for terminal auth, we'll still try to detect prompt
|
123
|
-
def login
|
124
|
-
match_re = [@node.prompt]
|
125
|
-
match_re << @username if @username
|
126
|
-
match_re << @password if @password
|
127
|
-
until (match = expect(match_re)) == @node.prompt
|
128
|
-
cmd(@node.auth[:username], nil) if match == @username
|
129
|
-
cmd(@node.auth[:password], nil) if match == @password
|
130
|
-
match_re.delete match
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
121
|
def exec state = nil
|
135
122
|
state == nil ? @exec : (@exec = state) unless vars :ssh_no_exec
|
136
123
|
end
|
@@ -20,14 +20,8 @@ module Oxidized
|
|
20
20
|
'Log' => @log }
|
21
21
|
|
22
22
|
@telnet = Net::Telnet.new telnet_opts
|
23
|
-
if @node.auth[:username] and @node.auth[:username].length > 0
|
24
|
-
expect username
|
25
|
-
@telnet.puts @node.auth[:username]
|
26
|
-
end
|
27
|
-
expect password
|
28
|
-
@telnet.puts @node.auth[:password]
|
29
23
|
begin
|
30
|
-
|
24
|
+
login
|
31
25
|
rescue Timeout::Error
|
32
26
|
raise PromptUndetect, ['unable to detect prompt:', @node.prompt].join(' ')
|
33
27
|
end
|
data/lib/oxidized/manager.rb
CHANGED
@@ -6,66 +6,59 @@ module Oxidized
|
|
6
6
|
class Manager
|
7
7
|
class << self
|
8
8
|
def load dir, file
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
break if klass
|
17
|
-
end
|
18
|
-
i = klass.new
|
19
|
-
i.setup if i.respond_to? :setup
|
20
|
-
{ file => klass }
|
21
|
-
rescue LoadError
|
22
|
-
{}
|
9
|
+
require File.join dir, file + '.rb'
|
10
|
+
klass = nil
|
11
|
+
[Oxidized, Object].each do |mod|
|
12
|
+
klass = mod.constants.find { |const| const.to_s.downcase == file.downcase }
|
13
|
+
klass = mod.constants.find { |const| const.to_s.downcase == 'oxidized' + file.downcase } unless klass
|
14
|
+
klass = mod.const_get klass if klass
|
15
|
+
break if klass
|
23
16
|
end
|
17
|
+
i = klass.new
|
18
|
+
i.setup if i.respond_to? :setup
|
19
|
+
{ file => klass }
|
20
|
+
rescue LoadError
|
21
|
+
false
|
24
22
|
end
|
25
23
|
end
|
26
|
-
|
24
|
+
|
25
|
+
attr_reader :input, :output, :source, :model, :hook
|
27
26
|
def initialize
|
28
27
|
@input = {}
|
29
28
|
@output = {}
|
30
|
-
@model = {}
|
31
29
|
@source = {}
|
32
|
-
@
|
30
|
+
@model = {}
|
31
|
+
@hook = {}
|
33
32
|
end
|
34
33
|
|
35
|
-
def add_input
|
36
|
-
|
37
|
-
return false if method.empty?
|
38
|
-
@input.merge! method
|
34
|
+
def add_input name
|
35
|
+
loader @input, Config::InputDir, "input", name
|
39
36
|
end
|
40
37
|
|
41
|
-
def add_output
|
42
|
-
|
43
|
-
return false if method.empty?
|
44
|
-
@output.merge! method
|
38
|
+
def add_output name
|
39
|
+
loader @output, Config::OutputDir, "output", name
|
45
40
|
end
|
46
41
|
|
47
|
-
def
|
48
|
-
|
49
|
-
_model = Manager.load File.join(Config::Root, 'model'), name
|
50
|
-
_model = Manager.load Config::ModelDir, name if _model.empty?
|
51
|
-
return false if _model.empty?
|
52
|
-
@model.merge! _model
|
42
|
+
def add_source name
|
43
|
+
loader @source, Config::SourceDir, "source", name
|
53
44
|
end
|
54
45
|
|
55
|
-
def
|
56
|
-
|
57
|
-
_source = Manager.load Config::SourceDir, _source
|
58
|
-
return false if _source.empty?
|
59
|
-
@source.merge! _source
|
46
|
+
def add_model name
|
47
|
+
loader @model, Config::ModelDir, "model", name
|
60
48
|
end
|
61
49
|
|
62
|
-
def add_hook
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
50
|
+
def add_hook name
|
51
|
+
loader @hook, Config::HookDir, "hook", name
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
# if local version of file exists, load it, else load global - return falsy value if nothing loaded
|
57
|
+
def loader hash, global_dir, local_dir, name
|
58
|
+
dir = File.join(Config::Root, local_dir)
|
59
|
+
map = Manager.load(dir, name) if File.exist? File.join(dir, name + ".rb")
|
60
|
+
map = Manager.load(global_dir, name) unless map
|
61
|
+
hash.merge!(map) if map
|
69
62
|
end
|
70
63
|
end
|
71
64
|
end
|
@@ -13,15 +13,8 @@ class EdgeCOS < Oxidized::Model
|
|
13
13
|
|
14
14
|
cmd 'show running-config'
|
15
15
|
|
16
|
-
cmd 'show access-list tcam-utilization' do |cfg|
|
17
|
-
comment cfg
|
18
|
-
end
|
19
|
-
|
20
|
-
cmd 'show memory' do |cfg|
|
21
|
-
comment cfg
|
22
|
-
end
|
23
|
-
|
24
16
|
cmd 'show system' do |cfg|
|
17
|
+
cfg.gsub! /^\s*System Up Time\s*:.*\n/i, ''
|
25
18
|
comment cfg
|
26
19
|
end
|
27
20
|
|
data/lib/oxidized/model/junos.rb
CHANGED
@@ -12,11 +12,8 @@ class JunOS < Oxidized::Model
|
|
12
12
|
end
|
13
13
|
|
14
14
|
cmd :secret do |cfg|
|
15
|
-
cfg.gsub!(/encrypted-password (\S+).*/, 'encrypted-password <secret removed>')
|
16
|
-
cfg.gsub!(/pre-shared-key ascii-text (\S+).*/, 'pre-shared-key ascii-text <secret removed>')
|
17
|
-
cfg.gsub!(/pre-shared-key hexadecimal (\S+).*/, 'pre-shared-key hexadecimal <secret removed>')
|
18
|
-
cfg.gsub!(/authentication-key (\S+).*/, 'authentication-key <secret removed>')
|
19
15
|
cfg.gsub!(/community (\S+) {/, 'community <hidden> {')
|
16
|
+
cfg.gsub!(/ "\$\d\$\S+; ## SECRET-DATA/, ' <secret removed>;')
|
20
17
|
cfg
|
21
18
|
end
|
22
19
|
|
data/lib/oxidized/node.rb
CHANGED
@@ -15,13 +15,13 @@ module Oxidized
|
|
15
15
|
ip_addr, _ = opt[:ip].to_s.split("/")
|
16
16
|
Oxidized.logger.debug 'IPADDR %s' % ip_addr.to_s
|
17
17
|
@name = opt[:name]
|
18
|
-
@ip =
|
19
|
-
@ip ||=
|
20
|
-
@ip ||=
|
18
|
+
@ip = IPAddr.new(ip_addr).to_s rescue nil
|
19
|
+
@ip ||= Resolv.new.getaddress(@name) if Oxidized.config.resolve_dns?
|
20
|
+
@ip ||= @name
|
21
21
|
@group = opt[:group]
|
22
|
+
@model = resolve_model opt
|
22
23
|
@input = resolve_input opt
|
23
24
|
@output = resolve_output opt
|
24
|
-
@model = resolve_model opt
|
25
25
|
@auth = resolve_auth opt
|
26
26
|
@prompt = resolve_prompt opt
|
27
27
|
@vars = opt[:vars]
|
@@ -95,6 +95,7 @@ module Oxidized
|
|
95
95
|
:model => @model.class.to_s,
|
96
96
|
:last => nil,
|
97
97
|
:vars => @vars,
|
98
|
+
:mtime => @stats.mtime,
|
98
99
|
}
|
99
100
|
h[:full_name] = [@group, @name].join('/') if @group
|
100
101
|
if @last
|
@@ -126,6 +127,10 @@ module Oxidized
|
|
126
127
|
@retry = 0
|
127
128
|
end
|
128
129
|
|
130
|
+
def modified
|
131
|
+
@stats.update_mtime
|
132
|
+
end
|
133
|
+
|
129
134
|
private
|
130
135
|
|
131
136
|
def resolve_prompt opt
|
@@ -219,7 +224,6 @@ module Oxidized
|
|
219
224
|
end
|
220
225
|
|
221
226
|
# model
|
222
|
-
# FIXME: warning: instance variable @model not initialized
|
223
227
|
if Oxidized.config.models.has_key?(@model.class.name.to_s.downcase)
|
224
228
|
if Oxidized.config.models[@model.class.name.to_s.downcase].has_key?(key_str)
|
225
229
|
value = Oxidized.config.models[@model.class.name.to_s.downcase][key_str]
|
data/lib/oxidized/node/stats.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Oxidized
|
2
2
|
class Node
|
3
3
|
class Stats
|
4
|
+
attr_accessor :mtime
|
4
5
|
MAX_STAT = 10
|
5
6
|
|
6
7
|
# @param [Job] job job whose information add to stats
|
@@ -35,9 +36,14 @@ module Oxidized
|
|
35
36
|
@stats[:counter].reduce(0) { |m, h| h[0] == :success ? m : m + h[1] }
|
36
37
|
end
|
37
38
|
|
39
|
+
def update_mtime
|
40
|
+
@mtime = Time.now.utc
|
41
|
+
end
|
42
|
+
|
38
43
|
private
|
39
44
|
|
40
45
|
def initialize
|
46
|
+
@mtime = "unknown"
|
41
47
|
@stats = {}
|
42
48
|
@stats[:counter] = Hash.new 0
|
43
49
|
end
|
data/lib/oxidized/nodes.rb
CHANGED
@@ -10,7 +10,7 @@ module Oxidized
|
|
10
10
|
with_lock do
|
11
11
|
new = []
|
12
12
|
@source = Oxidized.config.source.default
|
13
|
-
Oxidized.mgr.add_source @source
|
13
|
+
Oxidized.mgr.add_source(@source) or raise(MethodNotFound, "cannot load node source '#{@source}', not found")
|
14
14
|
Oxidized.logger.info "lib/oxidized/nodes.rb: Loading nodes"
|
15
15
|
nodes = Oxidized.mgr.source[@source].new.load node_want
|
16
16
|
nodes.each do |node|
|
data/lib/oxidized/version.rb
CHANGED
data/lib/oxidized/worker.rb
CHANGED
@@ -53,6 +53,7 @@ module Oxidized
|
|
53
53
|
output = node.output.new
|
54
54
|
if output.store node.name, job.config,
|
55
55
|
:msg => msg, :email => node.email, :user => node.user, :group => node.group
|
56
|
+
node.modified
|
56
57
|
Oxidized.logger.info "Configuration updated for #{node.group}/#{node.name}"
|
57
58
|
Oxidized.Hooks.handle :post_store, :node => node,
|
58
59
|
:job => job,
|
data/oxidized.gemspec
CHANGED
@@ -37,7 +37,6 @@ Gem::Specification.new do |s|
|
|
37
37
|
s.add_development_dependency 'minitest', '~> 5.8'
|
38
38
|
s.add_development_dependency 'mocha', '~> 1.1'
|
39
39
|
s.add_development_dependency 'pry', '~> 0'
|
40
|
-
s.add_development_dependency 'rails_best_practices', '~> 1.19'
|
41
40
|
s.add_development_dependency 'rake', '~> 10.0'
|
42
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
41
|
+
s.add_development_dependency 'rubocop', '~> 0.57.1'
|
43
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oxidized
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saku Ytti
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-06-
|
13
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: asetus
|
@@ -172,20 +172,6 @@ dependencies:
|
|
172
172
|
- - "~>"
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
|
-
- !ruby/object:Gem::Dependency
|
176
|
-
name: rails_best_practices
|
177
|
-
requirement: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - "~>"
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '1.19'
|
182
|
-
type: :development
|
183
|
-
prerelease: false
|
184
|
-
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
requirements:
|
186
|
-
- - "~>"
|
187
|
-
- !ruby/object:Gem::Version
|
188
|
-
version: '1.19'
|
189
175
|
- !ruby/object:Gem::Dependency
|
190
176
|
name: rake
|
191
177
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,14 +192,14 @@ dependencies:
|
|
206
192
|
requirements:
|
207
193
|
- - "~>"
|
208
194
|
- !ruby/object:Gem::Version
|
209
|
-
version: 0.
|
195
|
+
version: 0.57.1
|
210
196
|
type: :development
|
211
197
|
prerelease: false
|
212
198
|
version_requirements: !ruby/object:Gem::Requirement
|
213
199
|
requirements:
|
214
200
|
- - "~>"
|
215
201
|
- !ruby/object:Gem::Version
|
216
|
-
version: 0.
|
202
|
+
version: 0.57.1
|
217
203
|
description: software to fetch configuration from network devices and store them
|
218
204
|
email:
|
219
205
|
- saku@ytti.fi
|
@@ -224,6 +210,7 @@ executables:
|
|
224
210
|
extensions: []
|
225
211
|
extra_rdoc_files: []
|
226
212
|
files:
|
213
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
227
214
|
- ".github/no-response.yml"
|
228
215
|
- ".gitignore"
|
229
216
|
- ".rubocop.yml"
|