otptoken_yubikey.py: Removed traceback when package missing.

IPA should suggest user to install dependent packages instead
of throwing traceback. To work with IPA and Yubikey, packages
libyubikey(not in official RHEL repo) and libusb are required.

Resolves: https://pagure.io/freeipa/issue/6979
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Tibor Dudlák 2017-07-28 14:46:16 +02:00 committed by Tomas Krizek
parent 5f03329051
commit 76357283ec
No known key found for this signature in database
GPG Key ID: 22A2A94B5E49415A

View File

@ -131,6 +131,9 @@ class otptoken_add_yubikey(Command):
raise NotFound(reason="No YubiKey found: %s" % e.strerror) raise NotFound(reason="No YubiKey found: %s" % e.strerror)
except yubico.yubikey.YubiKeyError as e: except yubico.yubikey.YubiKeyError as e:
raise NotFound(reason=e.reason) raise NotFound(reason=e.reason)
except ValueError as e:
raise NotFound(reason=str(e) + ". Please install 'libyubikey' "
"and 'libusb' packages first.")
assert yk.version_num() >= (2, 1) assert yk.version_num() >= (2, 1)