summaryrefslogtreecommitdiff
path: root/lib/oxidized/output
AgeCommit message (Collapse)Author
2018-04-21the great makeover - standardize layout, alignment, indentationWild Kat
2018-04-11eliminate tabs in favor of double spaceWild Kat
2017-04-12Add new output GitCryptClement Parisot
Signed-off-by: Clement Parisot <clement.parisot@uni.lu>
2016-12-12Recursively search from one dir above specifiedSaku Ytti
Fixes #626
2016-10-26return nil if we can't find fileSaku Ytti
unsure if we really should, or just raise the error and let consumer of fetch decide what to do with the error
2016-10-26fetch should return string, not arraySaku Ytti
Also if group was explicitly given, we referred to wrong directory
2016-08-29fix the node variable from `#fetch`. closes #529Danilo Sousa
in commit `de2a9d1` I changed the `#fetch` method to pass the `Node` object instead of the node name.
2016-08-28expand_path in file outputSaku Ytti
so that ``` output: file: directory: ~/foox ``` will work
2016-07-20remove `puts`Danilo Sousa
2016-07-20fixed the #fetch and #verions web problemsDanilo Sousa
apart from the refactorings, now the node path its correct even when groups are used
2016-05-25Fix git, String refers to Oxidized::StringSaku Ytti
Fixes #429
2016-05-20fixes #423Saku Ytti
2016-05-16fix the git group path configDanilo Sousa
* make sure to expand the paths of all repositories * get the right group repository path
2016-05-06fixes #413Saku Ytti
2016-04-27Fix exception when using git, groups, and single_repo methodTibshoOT
2016-02-22add requiresJeff Groom
2016-02-15Create http.rbJeff Groom
2016-01-04Merge remote-tracking branch 'upstream/master' into merge-upstreamElvin Efendi
2015-12-27expose git repo name and commit oid in hook mechanism and environment variablesNick Hilliard
2015-12-01meh further hack not to barf on version for filesSaku Ytti
2015-11-25add placeholder 'version' method for file outputSaku Ytti
2015-11-13better test framework, more specs and Travis CIElvin Efendi
2015-09-14cfg.repo needs to be fixed up with File.expand_path on initNick Hilliard
2015-09-13Expand repo's path, so that ~ worksSaku Ytti
Also remove trailing whitespaces
2015-08-26Add Author and MessageMrRJ45
Add Author and Message from a commit to a nodes version list
2015-07-06fix fetch for groups when single_repo: truejwhited
2015-07-05fix fetching when groups are used and single_repo: truejwhited
2015-06-17Merge pull request #114 from FlorianDoublet/webInterfaceFeaturesnopedial
add feature about versions and diffs for oxidized-web
2015-06-10add update for a node in log fileroot
2015-06-03add feature about versions and diffs for oxidized-webflorian
2015-05-26rugged is again in gemspec (mandatory)Saku Ytti
no point specifying the version again here. This was only when rugged was not required by gemspec
2015-04-20support having all groups in single repoSaku Ytti
output: git: single_repo: true would cause repos to appear as directories in group
2015-03-31Some Git libraries cant see initial commitMrRJ45
Using some libraries, in this case pygit2 the initial commit cannot be seen, a change and new commit fixes this. Adding index.write appears to be a simple fix, as confirmed in this rugged issue: https://github.com/libgit2/rugged/issues/441
2015-03-07Fix: Handle missing output fileJ. Brandt Buckley
If no output file is found, return nil. Previously, it would try to find the output file by doing a recursive glob search in the config dir. It would then try to open the file for reading regardless of whether any file was found. I ran into this when I fired up oxidized for the first time and tried to access a switch config on oxidized-web before it had a chance to collect it. In this scenario, you get a stack trace on the switch config page (e.g. `http://oxidized.example.com:8888/node/fetch/switch-001.example.com`): ``` Puma caught this error: undefined method `join' for #<String:0x007f3a3c4283f8> (NoMethodError) /usr/lib64/ruby/gems/2.2.0/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb:37:in `rescue in call' /usr/lib64/ruby/gems/2.2.0/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb:21:in `call' /usr/lib64/ruby/gems/2.2.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call' /usr/lib64/ruby/gems/2.2.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call' /usr/lib64/ruby/gems/2.2.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call' /usr/lib64/ruby/gems/2.2.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize' /usr/lib64/ruby/gems/2.2.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call' /usr/lib64/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/urlmap.rb:66:in `block in call' /usr/lib64/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/urlmap.rb:50:in `each' /usr/lib64/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/urlmap.rb:50:in `call' /usr/lib64/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:153:in `call' /usr/lib64/ruby/gems/2.2.0/gems/puma-2.11.1/lib/puma/server.rb:507:in `handle_request' /usr/lib64/ruby/gems/2.2.0/gems/puma-2.11.1/lib/puma/server.rb:375:in `process_client' /usr/lib64/ruby/gems/2.2.0/gems/puma-2.11.1/lib/puma/server.rb:262:in `block in run' /usr/lib64/ruby/gems/2.2.0/gems/puma-2.11.1/lib/puma/thread_pool.rb:104:in `call' /usr/lib64/ruby/gems/2.2.0/gems/puma-2.11.1/lib/puma/thread_pool.rb:104:in `block in spawn_thread' ```
2015-02-22Give more helpful error message from git errorsSaku Ytti
closes #61
2014-08-14never accept empty config in commitSaku Ytti
2014-08-14don't commit empty type configsSaku Ytti
2014-08-13don't commit empty config in git outputSaku Ytti
2014-08-12Support type_as_directory for git outputSaku Ytti
If set to true, repo will have directory matching model type, instead of new repo.
2014-08-12Merge branch 'master' into cfg_as_objectSaku Ytti
2014-08-11specify rugged versionSaku Ytti
with 0.19.0 (in rubygem-rugged-0.19.0-4.fc20.x86_64) you'll get this: /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/output/git.rb:69:in `create': wrong argument type nil (expected Hash) (TypeError) from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/output/git.rb:69:in `update_repo' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/output/git.rb:33:in `store' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/worker.rb:37:in `process' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/worker.rb:13:in `block in work' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/worker.rb:13:in `each' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/worker.rb:13:in `work' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/core.rb:36:in `run' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/core.rb:29:in `initialize' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/core.rb:11:in `new' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/core.rb:11:in `new' from /usr/local/share/gems/gems/oxidized-0.2.2/lib/oxidized/cli.rb:9:in `run' from /usr/local/share/gems/gems/oxidized-0.2.2/bin/oxidized:9:in `<top (required)>' from /usr/local/bin/oxidized:23:in `load' from /usr/local/bin/oxidized:23:in `<main>'
2014-08-08refactor cfg as objectSaku Ytti
- now default type is 'nil', which is collapsed to flat config via Outputs#to_cfg - if type is not 'nil' then name is automatically set if not set by model - if name and type is set, separate file is created - if name is not set, but type is set, outputs from type are collapsed as with 'nil' types This model: cmd 'show ip cef' do |out| out.type = 'poop' out.name = false out end cmd 'show process cpu' do |out| out.type = 'poop' out.name = 'my_cpu' out end cmd 'show memory statistics' do |out| out.type = 'poop' out.name = false out end cmd 'show ip bgp summary' do |out| out.type = 'poop' end Would produce git output: [ytti@ytti.fi ~/.config/oxidized]% ls poop bu.ip.fi bu.ip.fi--cpu bu.ip.fi--show_ip_bgp_summary [ytti@ytti.fi ~/.config/oxidized]% bu.ip.fi contains the collapsed stuff bu.ip.fi--cpu is manually named bu.ip.fi--show_ip_bgp_summary is automatically named
2014-08-07Keep config as Oxidized::Config instead of hashSaku Ytti
The model will look like this: cmd 'show ip cef' do |out| out.type = 'poop' out end cmd 'show process cpu' do |out| out.type = 'poop' out end cmd 'show memory statistics' do |out| out.type = 'poop' out end I think it's cleaner.
2014-08-07Pass model config as Outputs object instead of strSaku Ytti
These objects have some keys, such as 'type' and 'name', which allows our output model to discriminate on them. If ios.rb contains this: cmd 'show ip cef' do |out| { output: out, type: 'poop' } end cmd 'show process cpu' do |out| { output: out, type: 'poop' } end cmd 'show memory statistics' do |out| { output: out, type: 'poop' } end Our git output looks like this: [ytti@ytti.fi ~/.config/oxidized]% git clone oxidized.git Cloning into 'oxidized'... done. [ytti@ytti.fi ~/.config/oxidized]% git clone poop.git Cloning into 'poop'... done. [ytti@ytti.fi ~/.config/oxidized]% ls poop bu.ip.fi--show_ip_cef bu.ip.fi--show_memory_statistics bu.ip.fi--show_process_cpu [ytti@ytti.fi ~/.config/oxidized]% ls oxidized bu.ip.fi [ytti@ytti.fi ~/.config/oxidized]% Where oxidized repo contains standard config for all unspecified types (type is then 'cfg'), for all specified types instead of collapsing it into single string, we store them in 'type' repo with filename including 'name' of the command.
2014-07-14Allow it to work without local existing configSaku Ytti
Even after manually setting author+committer, it still crashed with: Config value 'user.name' was not found [Rugged::ConfigError] Not sure where it would want to use it, after author+committer already are set, but I guess this method is more robust anyhow.
2014-07-13Change from grit to ruggedSaku Ytti
a) grit is not supported, rugged is b) grit requires git CLI installed, rugged does not c) grit needs monkey patching to work, rugged does not Closes #21 Closes #22
2014-07-03Fix class name resolutionSaku Ytti
In new method, where we no long explicitly set loaded class name for later resolution we depend on file name being same as class name. However for File output, this is not true, because I didn't want plain File in code to resolve to Oxidized::File, and din't want to always write ::File, File ouput has class name OxFile. This change allows class names to start optionally with string 'Oxidized' if so, they still match.
2014-06-11Change dynamic discover of file => class nameSaku Ytti
We needed this, because use of 'def inherited' not idempotent, in Oxidized::Script use case we may need to restart Oxidized, even though it's already loaded, and we won't get class names populated via 'def inherited' anymore. There are quite many optiosn to do this a) filename == class name + no discovery/mapping, very clean - user 'source' must give us model name in exactly right capitalization b) add 'self' at end of files, so eval will return class name + deterministic with arbitrary name - DSL cruft, DSL being light is our main value (can we do this via parent class? I couldn't find way) c) load in new module via Module.module_eval X + module will contain only consts we just created - but which one is the one we want? - if we use eval, load errors won't tell line error But at least now we got rid of 'inherited' methods and not adding too much cruft, hope it's better than before.
2014-06-06fix: handle group in output git#fetchAnton Aksola
2014-04-16We rescue 'LoadError' in ManagerSaku Ytti
Let's raise OxidizedError instead for known dependencies