saltstack-formulas / zabbix-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
50 stars 121 forks source link

Seaprate server configuration template for 2.2 and 3.0+ #76

Closed hatifnatt closed 6 years ago

hatifnatt commented 6 years ago

Currently I'm working on new template for zabbix-server and I noticed there is a lot of changes between version 2.2 and 3.0+ of zabbix-server config, many parameters became supported or became deprecated. This can be managed with a lot of if blocks in template or with single if in state file and two template files. It's not DRY, but I think it will be way much easier to understand and maintain code with 2 separate templates than with single template bloated with lots of if - else. For example if support for 2.2 will be dropped it will enough to change few strings in state and delete template file for 2.2. With single template it will require more work to review and clean unnecessary if - else blocks.

Do you have any thoughts against splitting single template in two separate ones?

landergate commented 6 years ago

Practical approach, though I'm still wondering if full descriptions of each parameter are needed if we can keep only config values, which could minimize conditions and version differences. In case if zabbix instance is configured by configuration manager and being kept in sync with master's template, there would be no need to make any manual edits as they would get overwritten, so no actual need in details on site if those are reachable by software's repo/packages itself.

hatifnatt commented 6 years ago

Practically speaking, I agree, there is no need in comments in final configuration file. But if we talk about creating template or about finding differences with new version config, those comments, they are helping a lot. With comments you have anchors, you just need to insert template code in right place, without comments, it will be way much harder. As conclusion I want to say it's easier to create and maintain template with comments. It's bit hard for me to describe everything with words, I hope these pictures will give you an idea of what I'm talking about.

With comments: with comments Without comments: without comments

New parameter in v3.4? Easy! new parameter New parameter in v3.4? Good luck with it! default

landergate commented 6 years ago

@hatifnatt You have a point there. =) In that meaning, separating sounds better. Thanks for your time on explaining!