Skip to content
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

Fix: ra: Prevent to add unknown operation (bsc#1236442) #1679

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

liangxin1300
Copy link
Collaborator

  • When adding unknown operation, sanity check should give an error instead of a warning
  • And sanity check will return a big number to indicate this is a fatal error, so that the commit process will be aborted

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.78%. Comparing base (155bd2c) to head (edc47e9).

Additional details and impacted files
Flag Coverage Δ
integration 53.59% <100.00%> (+0.04%) ⬆️
unit 53.09% <14.28%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
crmsh/constants.py 100.00% <100.00%> (ø)
crmsh/ra.py 53.27% <100.00%> (+0.46%) ⬆️
crmsh/ui_configure.py 45.30% <100.00%> (+0.25%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@liangxin1300 liangxin1300 changed the title Dev: ra: Prevent to add unknown operation Fix: ra: Prevent to add unknown operation (bsc#1236442) Jan 27, 2025
- When adding unknown operation, sanity check should give an error instead of a warning
- And sanity check will return a big number to indicate this is a fatal
  error, so that the commit process will be aborted
@liangxin1300 liangxin1300 marked this pull request as ready for review February 5, 2025 07:58
@@ -744,6 +744,8 @@ def _verify(self, set_obj_semantic, set_obj_all):
rc1 = set_obj_all.verify()
if config.core.check_frequency != "never":
rc2 = set_obj_semantic.semantic_check(set_obj_all)
if rc2 >= constants.SANITY_FATAL_RC:
cib_factory.reset()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think reset() should not be called here.

  1. _verify() is also called from do_verify(). This subcommand should not have a side effect.
  2. Even when called from _commit(), it is enough to abort the commit, so that users will have a chance to modify their config instead of losing all the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants