-
Notifications
You must be signed in to change notification settings - Fork 90
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
goal: Removal of not-installed group does not fail #1013
Conversation
libdnf5/base/goal.cpp
Outdated
if (action == GoalAction::REMOVE) { | ||
// do not treat the removal of a not-installed group as an error | ||
skip_unavailable = true; | ||
} |
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.
This is minor. The call settings.resolve_skip_unavailable(cfg_main);
will incorrectly set that for the request was used some setting, but if it is a remove action then it is ignored.
What about to do something like:
bool skip_unavailable = action == GoalAction::REMOVE ? true : settings.resolve_skip_unavailable(cfg_main);
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.
Right, fixed.
e1f756b
to
28b61d7
Compare
libdnf5/base/goal.cpp
Outdated
bool skip_unavailable = settings.resolve_skip_unavailable(cfg_main); | ||
// For REMOVE action set skip_unavailable always to true | ||
// to not treat the removal of a not-installed group as an error | ||
bool skip_unavailable = action == GoalAction::REMOVE ? true : settings.resolve_skip_unavailable(cfg_main); |
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.
My apology, but I am thinking whether it is a good approach to hard code the behavior. skip_unavailable
has 3 options - TRUE
, FALSE
, AUTO
.
What about to add additional condition to action == GoalAction::REMOVE
and check whether settings.skip_unavailable == GoalSetting::AUTO
? And only if both conditions are
true
then use skip_unavailable=true
, otherwise use settings.resolve_skip_unavailable(cfg_main)
This change will allow API users to set behavior according to their expectations, but will keep reasonable default.
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.
OK, that make sense. I'll change also package removal accordingly.
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.
Done.
When the user attempts to remove a group that is not installed, only print a warning but the resolvement should not fail. Fixes: #917
28b61d7
to
e191760
Compare
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.
LGTM, but I have to test it.
e191760
to
8cbd697
Compare
This change enables API users to set stricter behavior for goal::add_remove() method regarding removal of not-installed packages. If skip_unavailable is not explicitly set, the default behavior remains to not error out.
8cbd697
to
1407909
Compare
Tested locally and it worked. |
When the user attempts to remove a group that is not installed, only
print a warning but the resolvement should not fail.
Fixes: #917
Test: rpm-software-management/ci-dnf-stack#1406