]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common/ceph/deployment/drive_group: fix 'orch ls --format yaml' 44446/head
authorSage Weil <sage@newdream.net>
Tue, 30 Nov 2021 04:25:43 +0000 (23:25 -0500)
committerSebastian Wagner <sewagner@redhat.com>
Mon, 3 Jan 2022 14:00:10 +0000 (15:00 +0100)
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 <sage@newdream.net>
(cherry picked from commit 7e51fe6227a92b92640d37216bdd99824c84769a)

src/python-common/ceph/deployment/drive_group.py
src/python-common/ceph/tests/test_drive_group.py

index 93d7aaef1779fab982622eacb3a7b18a03d1f0eb..b3ca04c3e3649d94a8dd5052d2cec397d2122350 100644 (file)
@@ -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')
 
index 76d343edada1b54c1796bcede2d407d5d299faad..f3896a6e7fc1c386bfa56f70678bd536c0f9ffd8 100644 (file)
@@ -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