Age | Commit message (Collapse) | Author |
|
|
|
so that ~/foo/bar works
|
|
closes #64
|
|
SQL file in configuration renamed to database.
Should the generated example file have host+user+password+query?
|
|
config option "file" got renamed to "database", added authentication options for other SQL adapters and an optional query argument to overwrite the generic query.
config snipplet:
sql:
adapter: mysql2
user: sqluser
password: sekrit
host: mysql.local
database: inventory
table: devices
query: SELECT `fqhn` AS `name`, lower(`vendor`) AS `model` FROM `devices` INNER JOIN `devtypes` ON (`devtypes`.`id` = `devices`.`model_id`) WHERE (`aktiv` = 'J')
map:
name: name
model: model
|
|
Closes #23
|
|
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.
|
|
- we need config/vars before model
- some whitespace changes
Bump up gemspec
|
|
|
|
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
|
|
Let's raise OxidizedError instead for known dependencies
|
|
Not every installation will use git + sql. Try to give helpful error
message on missing dependencies.
|
|
|
|
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
|
|
We now merge user config with bootstrap config ensuring all configuratio
options are set even if not in configuratatin. Allowing us to add new
configuration options, without needing for users to touch their existing
configuration.
All default values are still written to user config when ever CFG.save
is called, which means when you change your output/input/source models
and configuration is missing, instead of just adding the configuration
needed for that particular module, it'll save full config to file.
Don't really think that is a bug, but might be something to fix later on
with maybe parameter to 'save'. Which would load user config, merge it
with 'save' argument level and save user config. But unless someone is
bothered by it, I won't do it.
This commit fixes #1
|
|
No point creating the model for one-off use, especially with dodgy
dynamic consts
|
|
|
|
Silly for shit-and-giggles attempt at rancid
|