remote_client: Use blkid -L to find config drive by filesystem label

This change avoids the use of the re module to find the device name from
the normal blkid output.

Change-Id: I3c2c344768f6335c918565783da531db62b1bd3b
This commit is contained in:
Lee Yarwood 2020-03-02 20:04:49 +00:00
parent 6372ac2139
commit 99b7c11afa
1 changed files with 2 additions and 4 deletions

View File

@ -11,7 +11,6 @@
# under the License.
import functools
import re
import sys
import netaddr
@ -134,9 +133,8 @@ class RemoteClient(object):
This method will not unmount the config drive, so unmount_config_drive
must be used for cleanup.
"""
cmd_blkid = 'blkid | grep -i config-2'
result = self.exec_command(cmd_blkid)
dev_name = re.match('([^:]+)', result).group()
cmd_blkid = 'blkid -L config-2 -o device'
dev_name = self.exec_command(cmd_blkid).strip()
try:
self.exec_command('sudo mount %s /mnt' % dev_name)