-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce a centralized library to call the Checkmk API #291
Conversation
These has been used during the change process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the way you unified and simplified the API calls!
I have a question regarding the definition of the inheriting class, though. In some modules, there are multiple, different POST or GET calls. How would you define the related
def post(self)
calls for those?
related #176 |
I prepared a second module to use the API library (user) and I had minor problems/changes to the API.py - but I guess, you're referring more to the group modules, where you can post a single or multiple groups. For the users module, it felt very natural, to just use get/post/put/delete. If there is more than one put-call, I would probably use a suffix (e.g. On users (in the pipeline) I worked with the following:
|
First of all thanks, Concerning module, in essence it should at least cover all already implemented usage in different modules, otherwise it will be yet another modules which one has to adjust manually per module and not the central one. |
Would it be okay to add other modules one after another? It's a lot of work and I would prefer to take my time to avoid to introduce new Bugs. In the other Side it's very time consuming keeping a feature branch in sync with the main/devel for a longer period. |
I agree to update the modules one by one. And I agree, it's probably easier to have separate feature branches for each module change. |
when structure is fixed and accepted, I will also help with group modules. |
The behavior of the module.exit_json should be predictable across the project. This is now part of the first implementation of a centralized api. Also the api is now able to exit with module.fail_json. This shortens the code to run until the exit is executed eventually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine!
Introduce a centralized library to call the Checkmk API
The code to contact the Checkmk API is redundantly placed all over the modules. This projects aims to centralize this code into a single library to make our lifes more easy. Later changes may be done in one single place instead of changing several dozens of code lines.
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
What is the new behavior?
Other information
This PR contains a migrated module as an example on how to use this new library. The changes have been reduced to an absolute minimum to minimize potential bugs. So potential further refactorings may be skipped to have this change less complex.