Compare commits

...

No commits in common. "c8s-stream-DL1" and "stream-idm-DL1-rhel-8.9.0" have entirely different histories.

10 changed files with 124 additions and 1 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
SOURCES/python-yubico-1.3.2.tar.gz
/python-yubico-1.3.2.tar.gz

View File

@ -1 +0,0 @@
ce26775893e3d25c33e226b376d92dfe1ae114d6 SOURCES/python-yubico-1.3.2.tar.gz

View File

@ -0,0 +1,66 @@
From b4a53389c3e6ad41c836aa82998149f427fe1ad8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdudlak@redhat.com>
Date: Tue, 10 Sep 2019 19:12:19 +0200
Subject: [PATCH] Do not use comparision with "is" for literals
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There is a warning with python 3.8 at fedora rawhide about
comparision with "is" while running ipa-server install.
See: https://bugs.python.org/issue34850
Signed-off-by: Tibor Dudlák <tdudlak@redhat.com>
---
yubico/yubikey_config.py | 4 ++--
yubico/yubikey_usb_hid.py | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/yubico/yubikey_config.py b/yubico/yubikey_config.py
index b5a30c4..caeed02 100644
--- a/yubico/yubikey_config.py
+++ b/yubico/yubikey_config.py
@@ -475,12 +475,12 @@ def to_frame(self, slot=1):
"""
data = self.to_string()
payload = data.ljust(64, yubico_util.chr_byte(0x0))
- if slot is 1:
+ if slot == 1:
if self._update_config:
command = SLOT.UPDATE1
else:
command = SLOT.CONFIG
- elif slot is 2:
+ elif slot == 2:
if self._update_config:
command = SLOT.UPDATE2
else:
diff --git a/yubico/yubikey_usb_hid.py b/yubico/yubikey_usb_hid.py
index c07dcaa..b87ff3c 100644
--- a/yubico/yubikey_usb_hid.py
+++ b/yubico/yubikey_usb_hid.py
@@ -285,13 +285,13 @@ def _waitfor(self, mode, mask, may_block, timeout=2):
seconds_left = min(20, seconds_left)
wait_num = (seconds_left * 2) - 1 + 6
- if mode is 'nand':
+ if mode == 'nand':
if not flags & mask == mask:
finished = True
else:
self._debug("Status %s (0x%x) has not cleared bits %s (0x%x)\n"
% (bin(flags), flags, bin(mask), mask))
- elif mode is 'and':
+ elif mode == 'and':
if flags & mask == mask:
finished = True
else:
@@ -303,7 +303,7 @@ def _waitfor(self, mode, mask, may_block, timeout=2):
if not finished:
wait_num -= 1
if wait_num == 0:
- if mode is 'nand':
+ if mode == 'nand':
reason = 'Timed out waiting for YubiKey to clear status 0x%x' % mask
else:
reason = 'Timed out waiting for YubiKey to set status 0x%x' % mask

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
# recipients: abokovoy, frenaud, kaleem, ftrivino, cheimes
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (python-yubico-1.3.2.tar.gz) = d1ae5797d65793b0f8e26501d40002abaaff650449056771f9a23bc15a4e132dec1aec91e5900dbf17aeb6551303c39791698946de6599d0c558bf397e69e5ac

8
tests/sanity.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
set -ex
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
dnf install -y python3-yubico
exec ${DIR}/test_ipa_yubikey.py

28
tests/test_ipa_yubikey.py Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/python3
"""Simple test for APIs used by IPA's otptoken plugin
"""
import logging
import yubico
import usb.core
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
def main():
try:
yk = yubico.find_yubikey()
except usb.core.USBError as e:
log.info(e)
except yubico.yubikey.YubiKeyError as e:
log.info(e)
else:
assert yk.version_num()
log.info(yk.status())
log.info(yk.status().valid_configs())
log.info("PASS")
if __name__ == "__main__":
main()

13
tests/tests.yml Normal file
View File

@ -0,0 +1,13 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-source
- role: standard-test-basic
required_packages:
- python3-yubico
tests:
- test_ipa_yubikey:
dir: "tests"
run: ./test_ipa_yubikey.py