summaryrefslogtreecommitdiff
path: root/lib/oxidized/output
AgeCommit message (Collapse)Author
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
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.
2014-02-23Migrate to sinatra/puma from webrickSaku Ytti
As I can't do IO#select on sinatra/puma to run it when I have time, I have to run it on separate thread. This means Nodes container needs to be thread safe, it now has ghetto mutex locking, but I probably need to be be more focused what are the external methods that can be called and wrap those in @mutex.synchronize Provide also HTML UI not just JSON for ghetto UI to people who don't want to integrate
2013-10-26cleanup ascii API outputnopedial
2013-10-26add fetch API to git outputnopedial
2013-10-23finalize fetch API callnopedial
2013-10-15Update file.rbSamer Abdel-Hafez
2013-10-15fix fetch search and broken outputnopedial
2013-10-15enhance fetch supportnopedial
2013-10-14implement fetch into output modelnopedial
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.