krig / salt-module-crmsh

Salt Execution Module for Pacemaker clusters using crmsh
Apache License 2.0
2 stars 1 forks source link

Using a unified function. #4

Closed nick-wang closed 6 years ago

nick-wang commented 6 years ago

I write it to explain my idea on https://github.com/krig/salt-module-crmsh/issues/2 ,so it may have some grammar errors need debug. I will continue to do it if it is worth to do.

I think this version will be more complex for 1 or 2 commands, but up to 20+, It will show the difference in maintaining and developing, since only need to modify the "configure_table" when adding new function or maybe add an exception process if necessary. Most of the crm commands share the same approach. And it is quite easy to change the policy to call "crm configure" with exactly the same salt parameter for the "unknown/not implemented yet" command.

Hmm... sorry I was lied when saying nothing changed from user. User should call like "salt '' crmsh.configure cmd=show xxx" instead of "salt '' crmsh.configure_show xxx". Besides that, it should work as the same behavior like the base version.

krig commented 6 years ago

Hmm... sorry I was lied when saying nothing changed from user. User should call like "salt '' crmsh.configure cmd=show xxx" instead of "salt '' crmsh.configure_show xxx". Besides that, it should work as the same behavior like the base version.

This is the change I don't want. Each command should be a proper command in salt, not a parameter to a generic command.

nick-wang commented 6 years ago

This is the change I don't want. Each command should be a proper command in salt, not a parameter to a generic command.

I see. This requirement can be fixed with a wrapper of "configure" function, but will still need a real short function like "start, stop, etc..." to call the wrapper, but it looks clumsy which i shall pass. I don't have a decent and satisfied solution of it, so i think we can close this.

krig commented 6 years ago

You have a good point that most of the commands are almost the same, we should be able to simplify the implementation of each command quite a lot.

nick-wang commented 6 years ago

You have a good point that most of the commands are almost the same, we should be able to simplify the implementation of each command quite a lot.

yes, maybe we need another solution to do it. Keep watching it and close this pr. Tack!