1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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
This commit is contained in:
Toshio Kuratomi 2018-05-07 11:12:42 -07:00 committed by GitHub
parent 5ec34f65d9
commit 75283983f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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