🐙 octavia-cli: make update logic clearer #11386
Merged
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
The
update_resource
andshould_update_resources
function deserved a clearer and more tested logic to make sure all update cases are covered.This closes #11234 as the messages displayed to users are now properly ordered and happening at the right execution time.
How
In
octavia-cli/octavia_cli/apply/commands.py
:should_update_resource
to make it explicitely handle the case when user does not validate the changes or when a local file changed. I also changed the message to make these clearer.update_resource
to first get user validation if needed (in case of a diff) and then callshould_update_resource
to decide if an update is required.In
octavia-cli/unit_tests/test_apply/test_commands.py
:update_resource
andshould_update_resource
by making the test cases more readable and disabling the mock ofshould_update_resource
used inupdate_resource
to make sure both function work well together.Reminder of the update logic we want:
We want to update a resource in these multiple contexts:
🚨 User Impact 🚨