summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/model.rb
AgeCommit message (Collapse)Author
2014-06-11move :remove_secret to varsSamer Abdel-Hafez
2014-05-06require config/vars earlier0.0.56Saku Ytti
- we need config/vars before model - some whitespace changes Bump up gemspec
2014-05-05Introduce node and group level varsAnton Aksola
Variables can now be fed to model from multiple locations. In order of preference: 1) node (from source) 2) group 3) global In a model vars should be accessed via 'vars' helper method though it is not required. Helper method ignores nil values so care needs to taken when designing model behaviour. Support for node level vars is currently available on sql source via 'vars_map' configuration. Following example populates node vars 'enable' and 'somevariable' from sql columns 'var_enable' and 'var_somevariable' sql: adapter: sqlite file: /home/aakso/.config/oxidized/sqrouter.db table: nodes map: name: hostname model: model group: node_group username: username password: password vars_map: enable: var_enablepw somevariable: var_somevariable
2014-04-16run cmd :secret blocks if CFG.remove_secret is setSaku Ytti
Model can inmplement something like cmd :secret do |cfg| cfg.sub! / secret (\d+) (\S+).*/, '\\1 SECRET' cfg end Which is called for all commands if CFG.remove_secret is set
2014-04-16remove web APISaku Ytti
It is now separately in oxidized-web package
2014-04-15Use String subclass in model#cmdSaku Ytti
Will allow convenience methods such as cmd :all do |cfg| cfg.pop.shift end instead of: cmd :all do |cfg| cfg.each_line.to_a[1..-2].join end And what ever convenience configs we come up with
2014-04-07pass command string to :all block for (example) to comment a commandAnton Aksola
that was run
2014-03-17Fix JunOS modelSaku Ytti
Block must return string, it returned nil which broke it. Also coerce type to string in future, so block won't fail so catastrophically, just output missing.
2014-03-14Introduce 'post' and 'pre' commandsSaku Ytti
Both post and pre are called after all 'cmd' are already called, but output from 'pre' is put on top of configuration output and output from 'post' is put on bottom of confguration output. Rationale is dynamic configuration, where you'll only know after running some commands what commands you want to run. Both except blocks, such as pre do # commands to execute end Both can be called multiple times
2014-03-01Add Model#output methodSaku Ytti
Outputs about what we've seen last in input class. Quite dirty in telnet, so not sure I'm going to support it. Let's see if there is use-case for it.
2013-05-01Add Model#expect, support block at post/pre configSaku Ytti
Now we can deal with pager and additional PW prompts, such as 'enable' Examples in IOS model how to use. The Telnet implementation is particularly fugly, I just need one line in 'waitfor' to handle pager while waiting for prompt, but couldn't figure out clean way to do it, so needed to rewrit whole Telnet#waitfor just to add that line.
2013-04-27Fix timeout on receiving command from inputSaku Ytti
2013-04-21Dont reimplement 'cmd', call #cmd from #getSaku Ytti
2013-04-21run Model::cmd(:all) for Model#cmd as wellSaku Ytti
2013-04-21Run 'main' method if it existsSaku Ytti
Gives alternative, maybe less awkward way to do conditional commands. You can first use cmd methods to gather stuff you want, then in main method you could conditional to things based on them, maybe futher call methods per model.
2013-04-19Add 'cmd :all' convenience, ran after each commandSaku Ytti
Easier screen-scraping, if each command produces always same set of cruft that needs to be removed
2013-04-17Initial commitSaku Ytti
Silly for shit-and-giggles attempt at rancid