From e848b3caba1dadbb1b46ada06b074fbf796fca17 Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Sun, 22 Apr 2018 14:00:42 -0500 Subject: Change the debug log fsync to a flush fsync() can be expensive on OSes and induce timeout failures when running with input debugging of SSH sessions. --- lib/oxidized/input/ssh.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index 27e81e0..37d6e75 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -100,7 +100,7 @@ module Oxidized ch.on_data do |_ch, data| if Oxidized.config.input.debug? @log.print data - @log.fsync + @log.flush end @output << data @output = @node.model.expects @output -- cgit v1.2.1 From 82d67f2f337df5dbef8109fc67ddc9a86ba79bdc Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sun, 22 Apr 2018 22:06:23 +0200 Subject: integrate codecov --- .rubocop_todo.yml | 29 ----------------------------- README.md | 2 +- oxidized.gemspec | 27 ++++++++++++++++----------- spec/spec_helper.rb | 8 ++++++++ 4 files changed, 25 insertions(+), 41 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b91409a..ac9dca5 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,14 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 5 -# Cop supports --auto-correct. -# Configuration parameters: Include, TreatCommentsAsGroupSeparators. -# Include: **/*.gemspec -Gemspec/OrderedDependencies: - Exclude: - - 'oxidized.gemspec' - # Offense count: 1 # Configuration parameters: Include. # Include: **/*.gemspec @@ -84,12 +76,6 @@ Layout/ElseAlignment: - 'lib/oxidized/output/gitcrypt.rb' - 'lib/oxidized/source/csv.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Layout/EmptyLineAfterMagicComment: - Exclude: - - 'oxidized.gemspec' - # Offense count: 17 # Cop supports --auto-correct. # Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines. @@ -338,7 +324,6 @@ Layout/SpaceInsideArrayLiteralBrackets: Exclude: - 'lib/oxidized/input/ssh.rb' - 'lib/oxidized/input/telnet.rb' - - 'oxidized.gemspec' # Offense count: 29 # Cop supports --auto-correct. @@ -384,12 +369,6 @@ Layout/SpaceInsideParens: - 'lib/oxidized/input/telnet.rb' - 'lib/oxidized/model/asa.rb' -# Offense count: 5 -# Cop supports --auto-correct. -Layout/SpaceInsidePercentLiteralDelimiters: - Exclude: - - 'oxidized.gemspec' - # Offense count: 6 # Cop supports --auto-correct. Layout/SpaceInsideRangeLiteral: @@ -758,18 +737,11 @@ Style/EmptyMethod: Exclude: - 'lib/oxidized/hook.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Style/Encoding: - Exclude: - - 'oxidized.gemspec' - # Offense count: 2 # Cop supports --auto-correct. Style/ExpandPathArguments: Exclude: - 'bin/console' - - 'oxidized.gemspec' # Offense count: 6 # Cop supports --auto-correct. @@ -944,7 +916,6 @@ Style/PercentLiteralDelimiters: Exclude: - 'lib/oxidized/config.rb' - 'lib/oxidized/input/ssh.rb' - - 'oxidized.gemspec' # Offense count: 22 # Cop supports --auto-correct. diff --git a/README.md b/README.md index 9e52792..76b9add 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Oxidized [![Build Status](https://travis-ci.org/ytti/oxidized.svg)](https://travis-ci.org/ytti/oxidized) [![Gem Version](https://badge.fury.io/rb/oxidized.svg)](http://badge.fury.io/rb/oxidized) [![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) +# Oxidized [![Build Status](https://travis-ci.org/ytti/oxidized.svg)](https://travis-ci.org/ytti/oxidized) [![codecov.io](https://codecov.io/gh/ytti/oxidized/coverage.svg?branch=master)](https://codecov.io/gh/ytti/oxidized?branch=master) [![Gem Version](https://badge.fury.io/rb/oxidized.svg)](http://badge.fury.io/rb/oxidized) [![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) Oxidized is a network device configuration backup tool. It's a RANCID replacement! diff --git a/oxidized.gemspec b/oxidized.gemspec index dfcaf4c..105da7e 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -1,39 +1,44 @@ -# coding: utf-8 -lib = File.expand_path('../lib', __FILE__) + +lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'oxidized/version' Gem::Specification.new do |s| s.name = 'oxidized' s.version = Oxidized::VERSION - s.licenses = %w( Apache-2.0 ) + s.licenses = %w[Apache-2.0] s.platform = Gem::Platform::RUBY - s.authors = [ 'Saku Ytti', 'Samer Abdel-Hafez', 'Anton Aksola' ] - s.email = %w( saku@ytti.fi sam@arahant.net aakso@iki.fi) + s.authors = ['Saku Ytti', 'Samer Abdel-Hafez', 'Anton Aksola'] + s.email = %w[saku@ytti.fi sam@arahant.net aakso@iki.fi] s.homepage = 'http://github.com/ytti/oxidized' s.summary = 'feeble attempt at rancid' s.description = 'software to fetch configuration from network devices and store them' s.rubyforge_project = s.name s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - s.executables = %w( oxidized ) + s.executables = %w[oxidized] s.require_path = 'lib' s.required_ruby_version = '>= 2.0.0' s.add_runtime_dependency 'asetus', '~> 0.1' - s.add_runtime_dependency 'slop', '~> 3.5' s.add_runtime_dependency 'net-ssh', '~> 4.1.0' s.add_runtime_dependency 'rugged', '~> 0.21', '>= 0.21.4' + s.add_runtime_dependency 'slop', '~> 3.5' if defined?(RUBY_VERSION) && RUBY_VERSION > '2.3' s.add_runtime_dependency 'net-telnet', '~> 0' end + + s.add_development_dependency 'simplecov' + if ENV['CI'] == 'true' + s.add_development_dependency 'codecov' + end - s.add_development_dependency 'pry', '~> 0' s.add_development_dependency 'bundler', '~> 1.10' - s.add_development_dependency 'rake', '~> 10.0' + s.add_development_dependency 'git', '~> 1' s.add_development_dependency 'minitest', '~> 5.8' s.add_development_dependency 'mocha', '~> 1.1' - s.add_development_dependency 'git', '~> 1' - s.add_development_dependency 'rubocop', '~> 0.55.0' + s.add_development_dependency 'pry', '~> 0' s.add_development_dependency 'rails_best_practices', '~> 1.19' + s.add_development_dependency 'rake', '~> 10.0' + s.add_development_dependency 'rubocop', '~> 0.55.0' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2b49a6c..fc5167f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,11 @@ +require 'simplecov' +SimpleCov.start + +if ENV['CI'] == 'true' + require 'codecov' + SimpleCov.formatter = SimpleCov::Formatter::Codecov +end + require 'minitest/autorun' require 'mocha/minitest' require 'oxidized' -- cgit v1.2.1 From ffd4cc1569df3a9ad5c1ac453861544762ac4853 Mon Sep 17 00:00:00 2001 From: ytti Date: Mon, 23 Apr 2018 15:44:00 +0300 Subject: Fix Brocade links Fixes #1302 --- docs/Supported-OS-Types.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/Supported-OS-Types.md b/docs/Supported-OS-Types.md index 4556946..8839cc3 100644 --- a/docs/Supported-OS-Types.md +++ b/docs/Supported-OS-Types.md @@ -32,12 +32,12 @@ * [VOSS (VSP Operating System Software)](/lib/oxidized/model/voss.rb) * [BOSS (Baystack Operating System Software)](/lib/oxidized/model/boss.rb) * Brocade - * [FabricOS](lib/oxidized/model/fabricos.rb) - * [Ironware](lib/oxidized/model/ironware.rb) - * [NOS (Network Operating System)](lib/oxidized/model/nos.rb) - * [Vyatta](lib/oxidized/model/vyatta.rb) - * [6910](lib/oxidized/model/br6910.rb) - * [SLX-OS](lib/oxidized/model/slxos.rb) + * [FabricOS](/lib/oxidized/model/fabricos.rb) + * [Ironware](/lib/oxidized/model/ironware.rb) + * [NOS (Network Operating System)](/lib/oxidized/model/nos.rb) + * [Vyatta](/lib/oxidized/model/vyatta.rb) + * [6910](/lib/oxidized/model/br6910.rb) + * [SLX-OS](/lib/oxidized/model/slxos.rb) * Casa * [Casa](/lib/oxidized/model/casa.rb) * Check Point -- cgit v1.2.1 From cb002959bfc776de117f2353041e9d40aa486585 Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 24 Apr 2018 10:07:51 -0500 Subject: Add a note about database engine reserved keywords. --- docs/Sources.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/Sources.md b/docs/Sources.md index 6d8e19e..eb3cd0c 100644 --- a/docs/Sources.md +++ b/docs/Sources.md @@ -59,6 +59,9 @@ pinentry-mode loopback Oxidized uses the `sequel` ruby gem. You can use a variety of databases that aren't explicitly listed. For more information visit https://github.com/jeremyevans/sequel Make sure you have the correct adapter! +**NOTE** - Many database engines have reserved keywords that may conflict with Oxidized configuration field names (such as 'name', 'group', etc). Pay attention to any names that are used and observed proper quoting methods to avoid errors or unpredictable results. + + ## Source: MYSQL `sudo apt-get install libmysqlclient-dev` -- cgit v1.2.1 From 6d9181ae1a191a9e4bfc028edfd3c5b5d0435d0e Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 24 Apr 2018 10:08:58 -0500 Subject: Consistency - add a link back to Model-Notes at the bottom --- docs/Model-Notes/ArbOS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Model-Notes/ArbOS.md b/docs/Model-Notes/ArbOS.md index f68467f..ebac997 100644 --- a/docs/Model-Notes/ArbOS.md +++ b/docs/Model-Notes/ArbOS.md @@ -8,3 +8,5 @@ If you are running ArbOS version 7 or lower then you may need to update the mode pre_logout 'exit' end ``` + +Back to [Model-Notes](README.md) -- cgit v1.2.1 From ffbc250f019fadabb7fd26b046c2a2e8e235b33c Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 24 Apr 2018 10:09:28 -0500 Subject: Consistency - add a link back to Model-Notes at the bottom --- docs/Model-Notes/Comware.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Model-Notes/Comware.md b/docs/Model-Notes/Comware.md index e7a2198..048f312 100644 --- a/docs/Model-Notes/Comware.md +++ b/docs/Model-Notes/Comware.md @@ -10,3 +10,5 @@ info-center source default channel 1 log state off debug state off ``` [Reference](https://github.com/ytti/oxidized/issues/1171) + +Back to [Model-Notes](README.md) -- cgit v1.2.1 From b6f4c3665b773ae0ba95a9a6084392d47779e8fd Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 24 Apr 2018 10:10:06 -0500 Subject: Netgear notes updates Consistency - add a link back to Model-Notes at the bottom Tag a YAML block as YAML for highlighting. --- docs/Model-Notes/Netgear.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/Model-Notes/Netgear.md b/docs/Model-Notes/Netgear.md index 9bfd094..d82bdcc 100644 --- a/docs/Model-Notes/Netgear.md +++ b/docs/Model-Notes/Netgear.md @@ -6,7 +6,7 @@ There are several models available with CLI management via telnet (port 60000), ``` Connected to 192.168.3.201. -(GS748Tv4) +(GS748Tv4) Applying Interface configuration, please wait ...admin Password:******** (GS748Tv4) >enable @@ -42,7 +42,7 @@ Configuration for older/newer models: make sure you have defined variable 'enabl One possible configuration: - oxidized config -``` +```yaml source: default: csv csv: @@ -63,4 +63,6 @@ switchOldFW:netgear:admin:adminpw::60000 switchNewFW:netgear:admin:adminpw:true:60000 ``` -[Reference](https://github.com/ytti/oxidized/pull/1268) \ No newline at end of file +[Reference](https://github.com/ytti/oxidized/pull/1268) + +Back to [Model-Notes](README.md) -- cgit v1.2.1 From d1723993e6048621f6a2428bcba51c1cd17a124e Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 24 Apr 2018 10:11:24 -0500 Subject: Ruby-API.md cleanups Refer to things as 'device' versus 'switch' Add some example use case notes for post_login and pre_logout. MD highlight some items in the list for clarity misc text clarity adjustments. --- docs/Ruby-API.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/Ruby-API.md b/docs/Ruby-API.md index 8621870..a9963b3 100644 --- a/docs/Ruby-API.md +++ b/docs/Ruby-API.md @@ -6,7 +6,7 @@ The following objects exist in Oxidized. * gets config from nodes * must implement 'connect', 'get', 'cmd' -* 'ssh', 'telnet, ftp, and tftp' implemented +* 'ssh', 'telnet', 'ftp', and 'tftp' implemented ## Output @@ -18,12 +18,12 @@ The following objects exist in Oxidized. * gets list of nodes to poll * must implement 'load' -* source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt' - * name - name of the devices - * model - model to use ios/junos/xyz, model is loaded dynamically when needed (Also default in config file) - * input - method to acquire config, loaded dynamically as needed (Also default in config file) - * output - method to store config, loaded dynamically as needed (Also default in config file) - * prompt - prompt used for node (Also default in config file, can be specified in model too) +* source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt' for each device. + * `name` - name of the device + * `model` - model to use ('ios', 'junos', etc).The model is loaded dynamically by the first node of that model type. (Also default in config file) + * `input` - method to acquire config, loaded dynamically as needed (Also default in config file) + * `output` - method to store config, loaded dynamically as needed (Also default in config file) + * `prompt` - prompt used for node (Also default in config file, can be specified in model too) * 'sql', 'csv' and 'http' (supports any format with single entry per line, like router.db) ## Model @@ -116,16 +116,20 @@ the password prompt. If not specified, the default of `/^Password/` is used. #### `post_login` Used inside `cfg` invocations to specify commands to run once Oxidized has -logged in to the switch. Takes one argument that is either a block (taking zero +logged in to the device. Takes one argument that is either a block (taking zero parameters) or a string containing a command to execute. +This allows `post_login` to be used for any model-specific items prior to running the regular commands. This could include disabling the output pager or timestamp outputs that would cause constant differences. + #### `pre_logout` Used to specify commands to run before Oxidized closes the connection to the -switch. Takes one argument that is either a block (taking zero parameters) or a +device. Takes one argument that is either a block (taking zero parameters) or a string containing a command to execute. +This allows `pre_logout` to be used to 'undo' any changes that may have been needed via `post_login` (restore pager output, etc.) + #### `send` Usually used inside `expect` or blocks passed to `post_login`/`pre_logout`. -Takes a single parameter: a string to be sent to the switch. +Takes a single parameter: a string to be sent to the device. -- cgit v1.2.1 From e383a573e6c11f7366ce52774e191f7272db114f Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 24 Apr 2018 10:13:49 -0500 Subject: Misc Hooks.md cleanups misc text clarity. clarify timeout is in seconds clarity the publickey/privatekey are paths - not the keys themselves. Reorder the AWS SNS example of describing the config before the example config for consistency with the rest. --- docs/Hooks.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/Hooks.md b/docs/Hooks.md index fb80a19..ff430ca 100644 --- a/docs/Hooks.md +++ b/docs/Hooks.md @@ -1,6 +1,6 @@ # Hooks -You can define arbitrary number of hooks that subscribe different events. The hook system is modular and different kind of hook types can be enabled. +You can define an arbitrary number of hooks that subscribe to different events. The hook system is modular and different kind of hook types can be enabled. ## Configuration @@ -38,10 +38,10 @@ OX_REPO_COMMITREF OX_REPO_NAME ``` -Exec hook recognizes following configuration keys: +Exec hook recognizes the following configuration keys: -* `timeout`: hard timeout for the command execution. SIGTERM will be sent to the child process after the timeout has elapsed. Default: 60 -* `async`: influences whether main thread will wait for the command execution. Set this true for long running commands so node pull is not blocked. Default: false +* `timeout`: hard timeout (in seconds) for the command execution. SIGTERM will be sent to the child process after the timeout has elapsed. Default: `60` +* `async`: Execute the command in an asynchronous fashion. The main thread by default will wait for the hook command execution to complete. Set this to `true` for long running commands so node configuration pulls are not blocked. Default: `false` * `cmd`: command to run. ### exec hook configuration example @@ -79,8 +79,8 @@ For ssh key-based authentication, it is possible to set the environment variable * `remote_repo`: the remote repository to be pushed to. * `username`: username for repository auth. * `password`: password for repository auth. -* `publickey`: public key for repository auth. -* `privatekey`: private key for repository auth. +* `publickey`: public key file path for repository auth. +* `privatekey`: private key file path for repository auth. When using groups, each group must have a unique entry in the `remote_repo` config. @@ -95,7 +95,7 @@ hooks: ### githubrepo hook configuration example -Authenticate with a username and a password: +Authenticate with a username and a password without groups in use: ```yaml hooks: @@ -130,6 +130,11 @@ Fields sent in the message: * `model`: Model name (e.g. `eos`) * `node`: Device hostname + +The AWS SNS hook requires the following configuration keys: + +* `region`: AWS Region name +* `topic_arn`: ASN Topic reference ### awssns hook configuration example ```yaml @@ -141,11 +146,6 @@ hooks: topic_arn: arn:aws:sns:us-east-1:1234567:oxidized-test-backup_events ``` -AWS SNS hook requires the following configuration keys: - -* `region`: AWS Region name -* `topic_arn`: ASN Topic reference - Your AWS credentials should be stored in `~/.aws/credentials`. ## Hook type: slackdiff -- cgit v1.2.1 From 7d450963907a76b26c47082b5c482a093ba3a533 Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 24 Apr 2018 10:15:45 -0500 Subject: A few Outputs.md textual cleanups misc clarity items --- docs/Outputs.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/Outputs.md b/docs/Outputs.md index 92c672c..fab3bf8 100644 --- a/docs/Outputs.md +++ b/docs/Outputs.md @@ -14,7 +14,7 @@ output: This uses the rugged/libgit2 interface. So you should remember that normal Git hooks will not be executed. -For a single repositories for all devices: +For a single repository containing all devices: ```yaml output: @@ -25,7 +25,7 @@ output: repo: "/var/lib/oxidized/devices.git" ``` -And for groups repositories: +And for group-based repositories: ```yaml output: @@ -68,7 +68,7 @@ output: This uses the gem git and system git-crypt interfaces. Have a look at [GIT-Crypt](https://www.agwa.name/projects/git-crypt/) documentation to know how to install it. Additionally to user and email informations, you have to provide the users ID that can be a key ID, a full fingerprint, an email address, or anything else that uniquely identifies a public key to GPG (see "HOW TO SPECIFY A USER ID" in the gpg man page). -For a single repositories for all devices: +For a single repository containing all devices: ```yaml output: @@ -82,7 +82,7 @@ output: - "" ``` -And for groups repositories: +And for group-based repositories: ```yaml output: @@ -130,8 +130,9 @@ Please note that user list is only updated once at creation. ## Output: Http -POST a config to the specified URL +The HTTP output will POST a config to the specified HTTP URL. Basic username/password authentication is supported. +Example HTTP output configuration: ```yaml output: default: http @@ -185,4 +186,4 @@ which will result in the following layout diff/$FQDN--show_running_config nodiff/$FQDN--show_version nodiff/$FQDN--show_inventory -``` \ No newline at end of file +``` -- cgit v1.2.1 From 90a84a79279a0bac817ef871a4992e3d7d019cef Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 24 Apr 2018 10:16:38 -0500 Subject: Give some examples of smart loading Indicate that it can be used to have local site changes or updated models from the repo. minor text clarity on other items. --- docs/Creating-Models.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/Creating-Models.md b/docs/Creating-Models.md index d7a8155..3cb87c3 100644 --- a/docs/Creating-Models.md +++ b/docs/Creating-Models.md @@ -4,6 +4,8 @@ Oxidized supports a growing list of [operating system types](Supported-OS-Types. A user may wish to extend an existing model to collect the output of additional commands. Oxidized offers smart loading of models in order to facilitate this with ease, without the need to introduce changes to the upstream source code. +This methodology allows local site changes to be preserved during Oxidized version updates / gem updates. + ## Extending an existing model with a new command The example below can be used to extend the `JunOS` model to collect the output of `show interfaces diagnostics optics` and append the output to the configuration file as a comment. This command retrieves DOM information on pluggable optics present in a `JunOS`-powered chassis. @@ -25,13 +27,16 @@ class JunOS end ``` -Due to smart loading, the user-supplied `~/.config/oxidized/model/junos.rb` file will take precedence over the model with the same name included in Oxidized. The code then uses `require` to load the included model, and extends the class defined therein with an additional command. +Due to smart loading, the user-supplied `~/.config/oxidized/model/junos.rb` file will take precedence over the model with the same name included in the Oxidized distribution. + +The code then uses `require` to initially load the Oxidized-supplied model, and extends the class defined therein with an additional command. Intuitively, it is also possible to: * Completely re-define an existing model by creating a file in `~/.config/oxidized/model/` with the same name as an existing model, but not `require`-ing the upstream model file. -* Create a named variation of an existing model, by creating a file with a new name (such as `~/.config/oxidized/model/junos-extra.rb`), Then `require` the original model and extend its base class as in the above example. The named variation can then be specified as an OS type for some devices but not others when defining sources. +* Create a named variation of an existing model, by creating a file with a new name (such as `~/.config/oxidized/model/junos-extra.rb`), Then `require` the original model and extend its base class as in the above example. The named variation can then be specified as an OS type for specific devices that can benefit from the extra functionality. This allows for preservation of the base functionality for the default model types. * Create a completely new model, with a new name, for a new operating system type. +* Testing/validation of an updated model from the [Oxidized GitHub repo models](https://github.com/ytti/oxidized/tree/master/lib/oxidized/model) by placing an updated model in the proper location without disrupting the gem-supplied model files. ## Advanced features @@ -70,4 +75,4 @@ class JunOS end ``` -The output of the `show configuration | display set` command is marked with a new arbitrary alternative output type, `junos-set`. The `git` output will use the output type to create a new subdirectory by the same name. In this subdirectory, the `git` output will create files with the name `--set` that will contain the output of this command for each device. \ No newline at end of file +The output of the `show configuration | display set` command is marked with a new arbitrary alternative output type, `junos-set`. The `git` output will use the output type to create a new subdirectory by the same name. In this subdirectory, the `git` output will create files with the name `--set` that will contain the output of this command for each device. -- cgit v1.2.1 From cdcecd48fd05fecd656f384d074bd06406ac2690 Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 24 Apr 2018 10:17:40 -0500 Subject: clarity updates for Configuration doc typo fixes - IP-Adress -> IP-Address remove_secrets -> remove_secret tag a ruby block as ruby for correct highlight misc other small text clarity (ssh_proxy is the proxy information etc) --- docs/Configuration.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index 6bbbb61..661e65a 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -4,7 +4,7 @@ In case a model plugin doesn't work correctly (ios, procurve, etc.), you can enable live debugging of SSH/Telnet sessions. Just add a `debug` option containing the value true to the `input` section. The log files will be created depending on the parent directory of the logfile option. -The following example will log an active ssh/telnet session `/home/oxidized/.config/oxidized/log/-`. The file will be truncated on each consecutive ssh/telnet session, so you need to put a `tailf` or `tail -f` on that file! +The following example will log an active ssh/telnet session `/home/oxidized/.config/oxidized/log/-`. The file will be truncated on each consecutive ssh/telnet session, so you need to put a `tailf` or `tail -f` on that file! ```yaml log: /home/oxidized/.config/oxidized/log @@ -29,18 +29,18 @@ vars: ## Removing secrets -To strip out secrets from configurations before storing them, Oxidized needs the the remove_secrets flag. You can globally enable this by adding the following snippet to the global sections of the configuration file. +To strip out secrets from configurations before storing them, Oxidized needs the `remove_secret` flag. You can globally enable this by adding the following snippet to the global section of the configuration file. ```yaml vars: remove_secret: true ``` -Device models can contain substitution filters to remove potentially sensitive data from configs. +Device models that contain substitution filters to remove sensitive data will now be run on any fetched configuration. As a partial example from ios.rb: -```yaml +```ruby cmd :secret do |cfg| cfg.gsub! /^(snmp-server community).*/, '\\1 ' (...) @@ -64,7 +64,11 @@ vars: ## SSH Proxy Command -Oxidized can `ssh` through a proxy as well. To do so we just need to set `ssh_proxy` variable. +Oxidized can `ssh` through a proxy as well. To do so we just need to set `ssh_proxy` variable with the proxy host information. + +This can be provided on a per-node basis by mapping the proper fields from your source. + +An example for a `csv` input source that maps the 4th field as the `ssh_proxy` value. ```yaml ... @@ -79,7 +83,7 @@ vars_map: ## FTP Passive Mode -Oxidized uses ftp passive mode by default. Some devices require passive mode to be disabled. To do so, we can set `input.ftp.passive` to false +Oxidized uses ftp passive mode by default. Some devices require passive mode to be disabled. To do so, we can set `input.ftp.passive` to false - this will make use of FTP active mode. ```yaml input: @@ -192,10 +196,12 @@ rest: 10.0.0.1:8000/oxidized ## Triggered backups -A node can be moved to head-of-queue via the REST API `GET/POST /node/next/[NODE]`. +A node can be moved to head-of-queue via the REST API `GET/POST /node/next/[NODE]`. This can be useful to immediately schedule a fetch of the configuration after some other event such as a syslog message indicating a configuration update on the device. -In the default configuration this node will be processed when the next job worker becomes available, it could take some time if existing backups are in progress. To execute moved jobs immediately a new job can be added: +In the default configuration this node will be processed when the next job worker becomes available, it could take some time if existing backups are in progress. To execute moved jobs immediately a new job can be added automatically: ```yaml next_adds_job: true ``` + +This will allow for a more timely fetch of the device configuration. -- cgit v1.2.1 From ffe13443e7085f25f20447e7d1aec5569a01df5c Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Tue, 24 Apr 2018 23:42:21 +0200 Subject: implement probot no-response --- .github/no-response.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/no-response.yml diff --git a/.github/no-response.yml b/.github/no-response.yml new file mode 100644 index 0000000..983af83 --- /dev/null +++ b/.github/no-response.yml @@ -0,0 +1,13 @@ +# Configuration for probot-no-response - https://github.com/probot/no-response + +# Number of days of inactivity before an Issue is closed for lack of response +daysUntilClose: 14 +# Label requiring a response +responseRequiredLabel: user_pending +# Comment to post when closing an Issue for lack of response. Set to `false` to disable +closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. The information + that is currently in the issue is insufficient to take further action. + Feel free to re-open this issue if additional information becomes available, + or if you believe it has been closed in error. -- cgit v1.2.1 From b5d0e8316e95558ada0377273f42ccd802c8401b Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Tue, 24 Apr 2018 23:59:45 +0200 Subject: increase response countdown to 21 days to reduce churn --- .github/no-response.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/no-response.yml b/.github/no-response.yml index 983af83..9c4bbaa 100644 --- a/.github/no-response.yml +++ b/.github/no-response.yml @@ -1,7 +1,7 @@ # Configuration for probot-no-response - https://github.com/probot/no-response # Number of days of inactivity before an Issue is closed for lack of response -daysUntilClose: 14 +daysUntilClose: 21 # Label requiring a response responseRequiredLabel: user_pending # Comment to post when closing an Issue for lack of response. Set to `false` to disable -- cgit v1.2.1