Skip to content

Commit e8cd09f

Browse files
dasJguits
authored andcommitted
ceph-volume: Fix splitting with too many parts
The data can be anything and also contain a `=`, causing the line to fail with `Too many values to unpack`. In my case, it failed with `ID_FS_LABEL=pvc_name=rook-ceph-lvm-data-44f2gc`. Regression was introduced here: ceph#60006 Fixes: https://tracker.ceph.com/issues/71101 Signed-off-by: Janne Heß <[email protected]> (cherry picked from commit 315fb96)
1 parent 8df4497 commit e8cd09f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/ceph-volume/ceph_volume/tests/util/test_disk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ def setUp(self) -> None:
682682
E:DM_LV_LAYER=
683683
E:NVME_HOST_IFACE=none
684684
E:SYSTEMD_READY=1
685+
E:ENV_WITH_EQUALS_SIGN=test=abc
685686
G:systemd
686687
Q:systemd
687688
V:1"""
@@ -763,4 +764,4 @@ def test_slashed_path_with_bare_device(self) -> None:
763764
@patch('ceph_volume.util.disk.os.minor', Mock(return_value=0))
764765
@patch('ceph_volume.util.disk.os.major', Mock(return_value=999))
765766
def test_dashed_path_with_bare_device(self) -> None:
766-
assert disk.UdevData(self.fake_device).dashed_path == '/dev/cephtest'
767+
assert disk.UdevData(self.fake_device).dashed_path == '/dev/cephtest'

src/ceph-volume/ceph_volume/util/disk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ def __init__(self, path: str) -> None:
13961396
if data_type == 'I':
13971397
self.id = data
13981398
if data_type == 'E':
1399-
key, value = data.split('=')
1399+
key, value = data.split('=', maxsplit=1)
14001400
self.environment[key] = value
14011401
if data_type == 'G':
14021402
self.group = data

0 commit comments

Comments
 (0)