From 75283983f670f51dac0010baf9addb820d334ef7 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 7 May 2018 11:12:42 -0700 Subject: [PATCH] Use a more exact regex (#39811) The pattern we're matching can have zero or one p. Be more careful to match exactly that. Slight revision of #39730 --- lib/ansible/module_utils/facts/hardware/linux.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts/hardware/linux.py b/lib/ansible/module_utils/facts/hardware/linux.py index fd8ffb985a8..272823b518f 100644 --- a/lib/ansible/module_utils/facts/hardware/linux.py +++ b/lib/ansible/module_utils/facts/hardware/linux.py @@ -615,7 +615,7 @@ class LinuxHardware(Hardware): d['partitions'] = {} for folder in os.listdir(sysdir): - m = re.search("(" + diskname + r"[p]*\d+)", folder) + m = re.search("(" + diskname + r"[p]?\d+)", folder) if m: part = {} partname = m.group(1)