summaryrefslogtreecommitdiff
path: root/lib/oxidized/output/git.rb
AgeCommit message (Collapse)Author
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-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
2014-04-15Remove dependency to sequel, sqlite3 and gritSaku Ytti
Not every installation will use git + sql. Try to give helpful error message on missing dependencies.
2014-04-14Use 'asetus' for configuration filesSaku Ytti
Main benefits a) we get support for system wide configs b) we don't use symbols in config file, they're confusing to non-rubyist
2014-03-21Rescue git timeout, fixes #10Saku Ytti
At least I hope it fixes #10, since I didn't figure out how to introduce 10s I/O latency to confirm.
2013-10-26add fetch API to git outputnopedial
2013-04-21rename 'update' to 'store'Saku Ytti
'store' is more logical, as we cannot know if output method guarantees any version history which 'update' implies.
2013-04-19Add restful APISaku Ytti
2013-04-17Initial commitSaku Ytti
Silly for shit-and-giggles attempt at rancid