-
Notifications
You must be signed in to change notification settings - Fork 419
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
automatic: Check availability of config file #2146
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m-blaha
force-pushed
the
mblaha/dnf-automatic-config
branch
2 times, most recently
from
October 17, 2024 13:04
ea1ba50
to
14b029e
Compare
ppisar
approved these changes
Oct 17, 2024
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.
Otherwise your patch works for me.
If you are not going to address the two nitpicks, feel free to merge it as it is.
m-blaha
force-pushed
the
mblaha/dnf-automatic-config
branch
from
October 18, 2024 07:32
14b029e
to
ec8daf2
Compare
If a configuration file is explicitly specified on the command line, ensure that it exists and is readable. If the file is not found, notify the user immediately and terminate the process. This resolves issues where users may run dnf-automatic with unrecognized positional arguments, such as `dnf-automatic install`. The most natural approach to handle a non-existing config file would be by catching the exception thrown by the `read()` method of the `libdnf.conf.ConfigParser` class. Unfortunately, the Python bindings override the `read()` method at the SWIG level, causing it to suppress any potentially raised IOError. For details see this section of the commit rpm-software-management/libdnf@8f1fedf def ConfigParser__newRead(self, filenames): parsedFNames = [] try: if isinstance(filenames, str) or isinstance(filenames, unicode): filenames = [filenames] except NameError: pass for fname in filenames: try: self.readFileName(fname) parsedFNames.append(fname) except IOError: pass except Exception as e: raise RuntimeError("Parsing file '%s' failed: %s" % (fname, str(e))) return parsedFNames ConfigParser.read = ConfigParser__newRead Resolves: https://issues.redhat.com/browse/RHEL-46030
m-blaha
force-pushed
the
mblaha/dnf-automatic-config
branch
from
October 18, 2024 07:33
ec8daf2
to
bdd8224
Compare
ppisar
approved these changes
Oct 18, 2024
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.
Good.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If a configuration file is explicitly specified on the command line, ensure that it exists and is readable. If the file is not found, notify the user immediately and terminate the process.
This resolves issues where users may run dnf-automatic with unrecognized positional arguments, such as
dnf-automatic install
.Resolves: https://issues.redhat.com/browse/RHEL-46030
Test: rpm-software-management/ci-dnf-stack#1571