oxidized 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1bfddbfd99ad2fed7d779ec60118dbd86f4bad07
4
- data.tar.gz: beaccfd0dfd4b30f324bee21e24057972d76ec9d
3
+ metadata.gz: 08d1ddb80997414fda90c9aaa4c1cda7d572b092
4
+ data.tar.gz: 2f11578926ac497672dda0293231b53e90bf3f6e
5
5
  SHA512:
6
- metadata.gz: bae25268e3a819d06d65d4eb633946e7db774b078bed111ab3a99d351f449adfb6f6ae4cd862c214caceea990050057f3b59e2dd83ef80cfb45d1ba52ca8cb4a
7
- data.tar.gz: 518319120a58a267662c2dd27bda071b505a5ced89c94d38936ad69a0eedf015ba1c15aa47b43a24032d26238a77cc35d15c6260456ac563c3057db818cec43b
6
+ metadata.gz: 59f6306c9dd3e6d586ed21340f1844647d343692e00a6a17a5f841d1254ba26643b2747f1c66599cd567d8b03e3f44c2689aabca705be000f0d93f82c99b8546
7
+ data.tar.gz: 2352a0a428db0b54f971adf502c640142aed75b48bd0199fb380f2507bf49fb2d95cc13aeffd03db2c6d6f5760b5461fc9e222a28fc7b0f52ffdc3704d85c4b1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ # 0.6.0
2
+ - FEATURE: support cumulus linux (by @FlorianDoublet)
3
+ - FEATURE: support HP Comware SMB siwtches (by @sid3windr)
4
+ - FEATURE: remove secret additions (by @rodecker)
5
+ - FEATURE: option to put all groups in single repo (by @ytti)
6
+ - FEATURE: expand path in source: csv: (so that ~/foo/bar works) (by @ytti)
7
+ - BUGFIX: screenos fixes (by @rixxxx)
8
+ - BUGFIX: ironware fixes (by @FlorianDoublet)
9
+ - BUGFIX: powerconnect fixes (by @sid3windr)
10
+ - BUGFIX: don't ask interactive password in new net/ssh (by @ytti)
11
+
1
12
  # 0.5.0
2
13
  - FEATURE: Mikrotik RouterOS model (by @emjemj)
3
14
  - FEATURE: add support for Cisco VSS (by @MrRJ45)
@@ -22,7 +33,7 @@
22
33
  - BUGFIX: allow node to be removed while it is being collected
23
34
  - BUGFIX: if model returns non string value, return empty string
24
35
  - BUGFIX: better prompt for Arista EOS model (by @rodecker)
25
- - BUGFIX: improved configuration handling for Arista EOS model (by @rodecker)
36
+ - BUGFIX: improved configuration handling for Arista EOS model (by @rodecker)
26
37
 
27
38
  # 0.3.0
28
39
  - FEATURE: *FIXME* bunch of stuff I did for richih, docs needed
data/README.md CHANGED
@@ -55,6 +55,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacment
55
55
  * Cisco IOS-XR
56
56
  * Cisco NXOS
57
57
  * Cisco SMB (Nikola series)
58
+ * Cumulus Linux
58
59
  * DELL PowerConnect
59
60
  * Extreme Networks XOS
60
61
  * Force10 FTOS
data/Rakefile CHANGED
@@ -40,7 +40,12 @@ task :clean do
40
40
  FileUtils.rm_rf 'gems'
41
41
  end
42
42
 
43
+ desc 'Tag the release'
44
+ task :tag do
45
+ system "git tag #{gemspec.version}"
46
+ end
47
+
43
48
  desc 'Push to rubygems'
44
- task :push do
49
+ task :push => :tag do
45
50
  system "gem push gems/#{file}"
46
51
  end
@@ -23,7 +23,9 @@ module Oxidized
23
23
  @log = File.open(CFG.input.debug?.to_s + '-ssh', 'w') if CFG.input.debug?
24
24
  @ssh = Net::SSH.start @node.ip, @node.auth[:username],
25
25
  :password => @node.auth[:password], :timeout => CFG.timeout,
26
- :paranoid => secure
26
+ :paranoid => secure,
27
+ :auth_methods => %w(publickey password),
28
+ :number_of_password_prompts => 0
27
29
  unless @exec
28
30
  shell_open @ssh
29
31
  begin
@@ -21,6 +21,17 @@ class Comware < Oxidized::Model
21
21
  end
22
22
 
23
23
  cfg :telnet, :ssh do
24
+ # enable command-line mode on SMB comware switches (HP V1910, V1920)
25
+ # autodetection is hard, because the 'summary' command is paged, and
26
+ # the pager cannot be disabled before _cmdline-mode on.
27
+ if vars :comware_cmdline
28
+ post_login do
29
+ send "_cmdline-mode on\n"
30
+ send "y\n"
31
+ send vars(:comware_cmdline) + "\n"
32
+ end
33
+ end
34
+
24
35
  post_login 'screen-length disable'
25
36
  post_login 'undo terminal monitor'
26
37
  pre_logout 'quit'
@@ -0,0 +1,76 @@
1
+ class Cumulus < Oxidized::Model
2
+
3
+ prompt /^((\w*)@(.*)([>#]\s)+)$/
4
+ comment '# '
5
+
6
+
7
+ #add a comment in the final conf
8
+ def add_comment comment
9
+ "\n###### #{comment} ######\n"
10
+ end
11
+
12
+ cmd :all do |cfg|
13
+ cfg.each_line.to_a[1..-2].join
14
+ end
15
+
16
+ #show the persistent configuration
17
+ pre do
18
+ cfg = add_comment 'THE HOSTNAME'
19
+ cfg += cmd 'cat /etc/hostname'
20
+
21
+ cfg += add_comment 'THE HOSTS'
22
+ cfg += cmd 'cat /etc/hosts'
23
+
24
+ cfg += add_comment 'THE INTERFACES'
25
+ cfg += cmd 'cat /etc/network/interfaces'
26
+
27
+ cfg += add_comment 'RESOLV.CONF'
28
+ cfg += cmd 'cat /etc/resolv.conf'
29
+
30
+ cfg += add_comment 'NTP.CONF'
31
+ cfg += cmd 'cat /etc/ntp.conf'
32
+
33
+ cfg += add_comment 'QUAGGA DAEMONS'
34
+ cfg += cmd 'cat /etc/quagga/daemons'
35
+
36
+ cfg += add_comment 'QUAGGA ZEBRA'
37
+ cfg += cmd 'cat /etc/quagga/zebra.conf'
38
+
39
+ cfg += add_comment 'QUAGGA BGP'
40
+ cfg += cmd 'cat /etc/quagga/bgpd.conf'
41
+
42
+ cfg += add_comment 'QUAGGA OSPF'
43
+ cfg += cmd 'cat /etc/quagga/ospfd.conf'
44
+
45
+ cfg += add_comment 'QUAGGA OSPF6'
46
+ cfg += cmd 'cat /etc/quagga/ospf6d.conf'
47
+
48
+ cfg += add_comment 'MOTD'
49
+ cfg += cmd 'cat /etc/motd'
50
+
51
+ cfg += add_comment 'PASSWD'
52
+ cfg += cmd 'cat /etc/passwd'
53
+
54
+ cfg += add_comment ' SWITCHD'
55
+ cfg += cmd 'cat /etc/cumulus/switchd.conf'
56
+
57
+ cfg += add_comment 'ACL'
58
+ cfg += cmd 'iptables -L'
59
+
60
+ cfg += add_comment 'VERSION'
61
+ cfg += cmd 'cat /etc/cumulus/etc.replace/os-release'
62
+
63
+ end
64
+
65
+
66
+ cfg :telnet do
67
+ username /^Username:/
68
+ password /^Password:/
69
+ end
70
+
71
+ cfg :telnet, :ssh do
72
+ pre_logout 'exit'
73
+ end
74
+
75
+
76
+ end
@@ -13,6 +13,7 @@ class EOS < Oxidized::Model
13
13
  cmd :secret do |cfg|
14
14
  cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
15
15
  cfg.gsub! /username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>'
16
+ cfg.gsub! /^(enable secret).*/, '\\1 <configuration removed>'
16
17
  cfg
17
18
  end
18
19
 
@@ -1,9 +1,22 @@
1
1
  class IronWare < Oxidized::Model
2
2
 
3
+ prompt /^.+[>#]\s?$/
3
4
  comment '! '
5
+
6
+ #to handle pager without enable
7
+ #expect /^((.*)--More--(.*))$/ do |data, re|
8
+ # send ' '
9
+ # data.sub re, ''
10
+ #end
11
+
12
+
13
+ #to remove backspace (if handle pager without enable)
14
+ #expect /^((.*)[\b](.*))$/ do |data, re|
15
+ # data.sub re, ''
16
+ #end
4
17
 
5
18
  cmd :all do |cfg|
6
- cfg.each_line.to_a[1..-3].join
19
+ cfg.each_line.to_a[1..-2].join
7
20
  end
8
21
 
9
22
  cmd 'show running-config' do |cfg|
@@ -12,11 +25,21 @@ class IronWare < Oxidized::Model
12
25
  end
13
26
 
14
27
  cmd 'show version' do |cfg|
28
+ cfg.gsub! /(^((.*)system uptime(.*))$)/, '' #remove unwanted line system uptime
15
29
  comment cfg
16
30
  end
17
31
 
18
32
  cmd 'show chassis' do |cfg|
19
33
  cfg.gsub! "\xFF", '' # ugly hack - avoids JSON.dump utf-8 breakage on 1.9..
34
+ cfg.gsub! /(^((.*)Current temp(.*))$)/, '' #remove unwanted lines current temperature
35
+ comment cfg
36
+ end
37
+
38
+ cmd 'show flash' do |cfg|
39
+ comment cfg
40
+ end
41
+
42
+ cmd 'show module' do |cfg|
20
43
  comment cfg
21
44
  end
22
45
 
@@ -25,9 +48,19 @@ class IronWare < Oxidized::Model
25
48
  password /^Password:/
26
49
  end
27
50
 
51
+ #handle pager with enable
28
52
  cfg :telnet, :ssh do
53
+ if vars :enable
54
+ post_login do
55
+ send "enable\n"
56
+ send vars(:enable) + "\n"
57
+ end
58
+ end
29
59
  post_login 'skip-page-display'
60
+ post_login 'terminal length 0'
30
61
  pre_logout 'logout'
62
+ pre_logout 'exit'
63
+ pre_logout 'exit'
31
64
  end
32
65
 
33
- end
66
+ end
@@ -1,3 +1,4 @@
1
+ require 'strscan'
1
2
  require_relative 'outputs'
2
3
 
3
4
  module Oxidized
@@ -4,7 +4,7 @@ class PowerConnect < Oxidized::Model
4
4
 
5
5
  comment '! '
6
6
 
7
- expect /^\s--More--\s+.*$/ do |data, re|
7
+ expect /^\s*--More--\s+.*$/ do |data, re|
8
8
  send ' '
9
9
  data.sub re, ''
10
10
  end
@@ -50,8 +50,8 @@ class PowerConnect < Oxidized::Model
50
50
  skip_block = false
51
51
  cfg.each_line do |line|
52
52
  if line.match /Up\sTime|Temperature|Power Supplies/i
53
- # For 34xx, 54xx, 55xx, and 8024F we should skip this block (terminated by a blank line)
54
- skip_block = true if @model =~ /^(34|35)(24|48)$|^(54|55)(24|48)$|^8024$/
53
+ # For 34xx, 35xx, 54xx, 55xx, 62xx and 8024F we should skip this block (terminated by a blank line)
54
+ skip_block = true if @model =~ /^(34|35)(24|48)$|^(54|55)(24|48)$|^(62)(24|48)$|^8024$/
55
55
  end
56
56
  # If we have lines to skip do this until we reach and empty line
57
57
  if skip_block
@@ -64,5 +64,4 @@ class PowerConnect < Oxidized::Model
64
64
  out << "\n"
65
65
  end
66
66
 
67
-
68
67
  end
@@ -4,7 +4,7 @@ class ScreenOS < Oxidized::Model
4
4
 
5
5
  comment '! '
6
6
 
7
- prompt '/^([\w.-\(\)]+->\s?)$/'
7
+ prompt /^[\w.:\(\)-]+->\s?$/
8
8
 
9
9
  cmd :all do |cfg|
10
10
  cfg.each_line.to_a[2..-2].join
@@ -33,7 +33,10 @@ class ScreenOS < Oxidized::Model
33
33
 
34
34
  cfg :telnet, :ssh do
35
35
  post_login 'set console page 0'
36
- pre_logout 'exit'
36
+ pre_logout do
37
+ send "exit\n"
38
+ send "n"
39
+ end
37
40
  end
38
41
 
39
42
  end
@@ -68,17 +68,23 @@ class Git < Output
68
68
  def update repo, file, data
69
69
  return if data.empty?
70
70
  if @opt[:group]
71
- repo = File.join File.dirname(repo), @opt[:group] + '.git'
71
+ if @cfg.single_repo?
72
+ file = File.join @opt[:group], file
73
+ else
74
+ repo = File.join File.dirname(repo), @opt[:group] + '.git'
75
+ end
72
76
  end
73
- repo = Rugged::Repository.new repo
74
- update_repo repo, file, data, @msg, @user, @email
75
- rescue Rugged::OSError, Rugged::RepositoryError => open_error
76
77
  begin
77
- Rugged::Repository.init_at repo, :bare
78
- rescue => create_error
79
- raise GitError, "first '#{open_error.message}' was raised while opening git repo, then '#{create_error.message}' was while trying to create git repo"
78
+ repo = Rugged::Repository.new repo
79
+ update_repo repo, file, data, @msg, @user, @email
80
+ rescue Rugged::OSError, Rugged::RepositoryError => open_error
81
+ begin
82
+ Rugged::Repository.init_at repo, :bare
83
+ rescue => create_error
84
+ raise GitError, "first '#{open_error.message}' was raised while opening git repo, then '#{create_error.message}' was while trying to create git repo"
85
+ end
86
+ retry
80
87
  end
81
- retry
82
88
  end
83
89
 
84
90
  def update_repo repo, file, data, msg, user, email
@@ -18,7 +18,7 @@ class CSV < Source
18
18
 
19
19
  def load
20
20
  nodes = []
21
- open(@cfg.file).each_line do |line|
21
+ open(File.expand_path @cfg.file).each_line do |line|
22
22
  next if line.match /^\s*#/
23
23
  data = line.chomp.split @cfg.delimiter
24
24
  next if data.empty?
data/oxidized.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'oxidized'
3
- s.version = '0.5.0'
3
+ s.version = '0.6.0'
4
4
  s.licenses = %w( Apache-2.0 )
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = [ 'Saku Ytti', 'Samer Abdel-Hafez' ]
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
17
17
  s.add_runtime_dependency 'asetus', '~> 0.1'
18
18
  s.add_runtime_dependency 'slop', '~> 3.5'
19
19
  s.add_runtime_dependency 'net-ssh', '~> 2.8'
20
- s.add_runtime_dependency 'rugged', '~> 0.21.4'
20
+ s.add_runtime_dependency 'rugged', '~> 0.21', '>= 0.21.4'
21
21
  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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-03 00:00:00.000000000 Z
12
+ date: 2015-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asetus
@@ -58,6 +58,9 @@ dependencies:
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.21'
63
+ - - ">="
61
64
  - !ruby/object:Gem::Version
62
65
  version: 0.21.4
63
66
  type: :runtime
@@ -65,6 +68,9 @@ dependencies:
65
68
  version_requirements: !ruby/object:Gem::Requirement
66
69
  requirements:
67
70
  - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.21'
73
+ - - ">="
68
74
  - !ruby/object:Gem::Version
69
75
  version: 0.21.4
70
76
  description: software to fetch configuration from network devices and store them
@@ -110,6 +116,7 @@ files:
110
116
  - lib/oxidized/model/asa.rb
111
117
  - lib/oxidized/model/ciscosmb.rb
112
118
  - lib/oxidized/model/comware.rb
119
+ - lib/oxidized/model/cumulus.rb
113
120
  - lib/oxidized/model/eos.rb
114
121
  - lib/oxidized/model/fabricos.rb
115
122
  - lib/oxidized/model/fortios.rb
@@ -164,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
171
  version: '0'
165
172
  requirements: []
166
173
  rubyforge_project: oxidized
167
- rubygems_version: 2.4.5
174
+ rubygems_version: 2.2.2
168
175
  signing_key:
169
176
  specification_version: 4
170
177
  summary: feeble attempt at rancid