Age | Commit message (Collapse) | Author |
|
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
|
|
- 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
|