Idea of adding objects that are missing in the target controller #871
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Another idea was born while implementing CasC in our environment. The code is related to job templates but can be easily added to other object types.
What if someone wants to restore only non-existing objects on the target controller?
So, I found a variable called
controller_state
to create a condition to only add objects that are missing. However, I noticed that it took forever to finish because I was still looping over the object list. Additionally, a second issue appeared: if the same object was different in some way, the object was duplicated.I came up with the idea to get all objects and filter out the ones that already exist.
What do you think about this change? I know that this variable
controller_state
is making problem with the roles, because role can only be present or be absent, but I believe it can be easily resolved.How should this be tested?
Is there a relevant Issue open for this?
N/A
Other Relevant info, PRs, etc
N/A