]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common/ceph/deployment/drive_group: fix 'orch ls --format yaml' 44140/head
authorSage Weil <sage@newdream.net>
Tue, 30 Nov 2021 04:25:43 +0000 (23:25 -0500)
committerSage Weil <sage@newdream.net>
Tue, 30 Nov 2021 04:25:43 +0000 (23:25 -0500)
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>
src/python-common/ceph/deployment/drive_group.py
src/python-common/ceph/tests/test_drive_group.py

index 0befac1169e6895c6fd32dd629ab6c2974fd4391..8eb18cbdc04a614246b18eeb9405212f02077249 100644 (file)
@@ -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')
 
index 0199a4519387045632156c7727aa5c11e24c87c3..282f35a7cf9f2eb11fd5e2d489dd4756c74bce5f 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