From ed661823ad99c3573278c5aab63a3bc5ae6380cb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 29 Nov 2021 23:25:43 -0500 Subject: [PATCH] python-common/ceph/deployment/drive_group: fix 'orch ls --format yaml' In f76c02a658ed1de54a380381932bb58b6ab91d41 we may leave out the placement key when it is empty. If we take that path, we need to tolerate specs that are missing that key. Fixes: f76c02a658ed1de54a380381932bb58b6ab91d41 Signed-off-by: Sage Weil (cherry picked from commit 7e51fe6227a92b92640d37216bdd99824c84769a) --- src/python-common/ceph/deployment/drive_group.py | 2 +- src/python-common/ceph/tests/test_drive_group.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/python-common/ceph/deployment/drive_group.py b/src/python-common/ceph/deployment/drive_group.py index 93d7aaef1779f..b3ca04c3e3649 100644 --- a/src/python-common/ceph/deployment/drive_group.py +++ b/src/python-common/ceph/deployment/drive_group.py @@ -243,7 +243,7 @@ class DriveGroupSpec(ServiceSpec): try: args['placement'] = PlacementSpec.from_json(json_drive_group.pop('placement')) except KeyError: - raise DriveGroupValidationError('OSD spec needs a `placement` key.') + args['placement'] = PlacementSpec() args['service_type'] = json_drive_group.pop('service_type', 'osd') diff --git a/src/python-common/ceph/tests/test_drive_group.py b/src/python-common/ceph/tests/test_drive_group.py index 76d343edada1b..f3896a6e7fc1c 100644 --- a/src/python-common/ceph/tests/test_drive_group.py +++ b/src/python-common/ceph/tests/test_drive_group.py @@ -38,10 +38,6 @@ def test_DriveGroup(test_input): re.escape('Service Spec is not an (JSON or YAML) object. got "None"'), '' ), - ( - "Failed to validate Drive Group: OSD spec needs a `placement` key.", - '{}' - ), ( 'Failed to validate Drive Group: DeviceSelection cannot be empty', """ service_type: osd -- 2.39.5