From 7e51fe6227a92b92640d37216bdd99824c84769a 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 --- 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 0befac1169e68..8eb18cbdc04a6 100644 --- a/src/python-common/ceph/deployment/drive_group.py +++ b/src/python-common/ceph/deployment/drive_group.py @@ -257,7 +257,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 0199a45193870..282f35a7cf9f2 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.47.3