-
Notifications
You must be signed in to change notification settings - Fork 50
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
Handle missing native dependencies in securesystemslib.gpg #206
Handle missing native dependencies in securesystemslib.gpg #206
Conversation
securesystemslib.gpg.constants checks for the presence of a gpg binary at import time, save the result of this search in a constant HAVE_GPG so that we can use it later to present meaningful error messages when a function requiring gpg is called and the command isn't available. Signed-off-by: Joshua Lock <[email protected]>
Need to fix the |
856df02
to
283cea3
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.
Great work as always! Many thanks, @joshuagl! I have left 3 minuscule comments. Also, IIUC, we should be able to remove this block in aggregate_tests.py now (the call in L57 too), and in test_gpg.py replace
occurrences of
@unittest.skipIf(os.getenv("TEST_SKIP_GPG"), "gpg not found")
with
@unittest.skipIf(not securesystemslib.gpg.constants.HAVE_GPG, "gpg not found")
Right?
Thanks for the review @lukpueh !
Absolutely right. That will be a nice clean up. I'll update the PR with that and your other requested changes on Monday. |
Raise an UnsupportedLibraryError exception when functions that rely on invoking the gpg command are called on a system where gpg is unavailable. Signed-off-by: Joshua Lock <[email protected]>
Raise UnsupportedLibraryError from each function in the gpg modules when the native libraries needed by that function aren't available. Signed-off-by: Joshua Lock <[email protected]>
283cea3
to
6125013
Compare
Signed-off-by: Joshua Lock <[email protected]>
We don't need to detect the presence of the GPG command and set environment variables, instead we can use the HAVE_GPG constant which indicated whether a usable GPG command is present on the system. Signed-off-by: Joshua Lock <[email protected]>
6125013
to
d6c3933
Compare
I've update the PR to incorporate your suggested changes @lukpueh . Please take a look when you have the time. |
Fixes issue #:
#179
Description of the changes being introduced by the pull request:
gpg[2]
command in all functions that would call it and raiseUnsupportedLibraryError
securesystemslib.gpg
intry/except
logic so that the modules can always be imported cleanlysecuresystemslib.gpg
by raisingUnsupportedLibraryError
when a function requiring a native module dependency is calledsecuresystemslib.gpg
interfaces requiringgpg[2]
or native module dependencies from our pure python test environmentPlease verify and check that the pull request fulfils the following
requirements: