Repository navigation
refactor(processors): centralize dry-run diff in AbstractProcessor - #1353
Conversation
Signed-off-by: Rick Brouwer <[email protected]>
Signed-off-by: Rick Brouwer <[email protected]>
Signed-off-by: Rick Brouwer <[email protected]>
amimas
left a comment
There was a problem hiding this comment.
Thanks for looking into this @rickbrouwer . I think overall direction/structure is fine. Not sure if it's just me, but is it possible to make the change/logic for this a bit more easy to follow in the abstract processor?
I'm also wondering whether the abstract processor's __init__ function call the subclass function and save it as entity_in_gitlab. I think there are other areas where this can be used in future for reducing some of the boilerplates from the subclasses in future.
Yeah. Will refactor the extension mechanism to the template method pattern. |
Signed-off-by: Rick Brouwer <[email protected]>
Signed-off-by: Rick Brouwer <[email protected]>
amimas
left a comment
There was a problem hiding this comment.
I think the latest update looks really good @rickbrouwer . Thanks for keep working on it. Left couple of minor comments.
Just one thing stands out I think that might need a bit more clarification. Does the raw responses from python-gitlab contain read-only API fields (id, created_at, project_id, _links, etc.). If _get_current_state returns raw API objects while _get_desired_state returns clean YAML data from gitlabform config, then _print_diff will show every extra API field as a "deletion" or "modification."
Signed-off-by: Rick Brouwer <[email protected]>
amimas
left a comment
There was a problem hiding this comment.
Thanks again for working on this @rickbrouwer . I feel this will make it really easy for other proecessors to consume this and show drift/diff in the dry-run.
Four processors carried near-identical
_print_diffimplementations (project_settings,merge_requests_approvals,project_security_settings,project_variables). This pulls the shared flow intoAbstractProcessorand removes the TODO inmerge_requests_approvals.py.