From 570c82f068d58b1e6ad9d2611bf647c3c82e6db0 Mon Sep 17 00:00:00 2001 From: Joshua Schmidlkofer Date: Thu, 12 Dec 2019 00:45:33 -0800 Subject: [PATCH] Patch: fix seports to allow integers or string (#65134) Signed-off-by: Joshua Schmidlkofer --- lib/ansible/modules/system/seport.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/system/seport.py b/lib/ansible/modules/system/seport.py index 00a687c734a..6141a0f35fd 100644 --- a/lib/ansible/modules/system/seport.py +++ b/lib/ansible/modules/system/seport.py @@ -156,9 +156,13 @@ def semanage_port_get_type(seport, port, proto): :rtype: tuple :return: Tuple containing the SELinux type and MLS/MCS level, or None if not found. """ - ports = port.split('-', 1) - if len(ports) == 1: - ports.extend(ports) + if isinstance(port, str): + ports = port.split('-', 1) + if len(ports) == 1: + ports.extend(ports) + else: + ports = (port, port) + key = (int(ports[0]), int(ports[1]), proto) records = seport.get_all()