Use re.search instead of re.match

Required since we're not matching the start of the string.
This commit is contained in:
Joshua Boniface 2021-09-26 00:55:29 -04:00
parent 3a1cbf8d01
commit 075abec5fe
1 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ import psutil
import daemon_lib.common as common import daemon_lib.common as common
from distutils.util import strtobool from distutils.util import strtobool
from re import match from re import search
class CephOSDInstance(object): class CephOSDInstance(object):
@ -339,10 +339,10 @@ class CephOSDInstance(object):
raise Exception raise Exception
# Handle the partition ID portion # Handle the partition ID portion
if match(r'by-path', device) or match(r'by-id', device): if search(r'by-path', device) or search(r'by-id', device):
# /dev/disk/by-path/pci-0000:03:00.0-scsi-0:1:0:0 -> pci-0000:03:00.0-scsi-0:1:0:0-part1 # /dev/disk/by-path/pci-0000:03:00.0-scsi-0:1:0:0 -> pci-0000:03:00.0-scsi-0:1:0:0-part1
partition = '{}-part1'.format(device) partition = '{}-part1'.format(device)
elif match(r'nvme', device): elif search(r'nvme', device):
# /dev/nvme0n1 -> nvme0n1p1 # /dev/nvme0n1 -> nvme0n1p1
partition = '{}p1'.format(device) partition = '{}p1'.format(device)
else: else: