lausser / coshsh

Der deutschsprachige Open-Source-Monitoring-Workshop incl. Vortrag über Coshsh findet am 16./17.5.2024 in Neckarsulm statt. https://discord.gg/jDfPZ63FcJ
GNU Affero General Public License v3.0
37 stars 5 forks source link

allow arbitrary fields in recipe config to be used in datasource #3

Closed luxifr closed 6 years ago

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 0.0% when pulling 82127ce6c46468c1babb9b333f5b2968b6a41348 on luxifr:remove_recipe_field_limitation into fef3321d8d1d8f50389ae52aa739904b51d6bb89 on lausser:master.

lausser commented 6 years ago

Can you show me an example? I'm curious how you use these attributes.

luxifr commented 6 years ago

I have a filter that really consists of multiple items and I'd like to unpack that into more descriptive attributes. I could, of course, make them different data sources but the number of permutations in our environment is quite high and I'd like to re-use code and config as much as possible and minimize redundancy of code and config as much as possible while making both code and config as descriptive and obvious as possible.

Example:

[recipe_comp1plants_de_bw]
isa = recipe__base
datasources = generic_cmdb
filter = comp1,plant,de,bw

would become

[recipe_comp1plants_de_bw]
isa = recipe__base
datasources = generic_cmdb
company = comp1
facility_type = plant
country = de
region = bw

And I'm planning to extend on that once we can have arbitrary fields in the recipe.

This is when I found that I cannot use arbitrary recipe attributes as they are filtered by a white-list. I assume you did this as to not expose internal fields of the recipe instance to data source objects and the likes so my solution only adds additional fields specified in the recipe while keeping the white-list that will filter internal fields of the recipe object.

If there are reasons this cannot be merged that I didn't see, please let me know and I'll extend my PR to address these.