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()