]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
python-common/.../service_spec: implement ServiceSpec.__getnewargs__ to allow unpickl... wip-sjust-mgr-serialize-c9-break-harder
authorSamuel Just <sjust@redhat.com>
Wed, 29 Oct 2025 21:02:46 +0000 (21:02 +0000)
committerSamuel Just <sjust@redhat.com>
Wed, 29 Oct 2025 21:02:46 +0000 (21:02 +0000)
src/python-common/ceph/deployment/service_spec.py

index b773a17d12cf780904e771ac7025143e9aa828be..c985075f268d69104d6d81b3e46156a68f16b3be 100644 (file)
@@ -933,6 +933,16 @@ class ServiceSpec(object):
         sub_cls: Any = cls._cls(service_type)
         return object.__new__(sub_cls)
 
+
+    def __getnewargs__(self):
+        """
+        Pickle will pass the return of this function to __new__ upon
+        unpickle.  We need to ensure it gets service_type in order
+        to get the right subtype.
+        """
+        return (self.service_type,)
+
+
     def __init__(self,
                  service_type: str,
                  service_id: Optional[str] = None,