def __repr__(self):
return f"<ServiceDescription of {self.spec.one_line_str()}>"
- def to_json(self):
+ def to_json(self) -> OrderedDict:
out = self.spec.to_json()
status = {
'container_image_id': self.container_image_id,
c_status[k] = datetime.datetime.strptime(c_status[k], DATEFMT)
return cls(spec=spec, **c_status)
+ @staticmethod
+ def yaml_representer(dumper: 'yaml.SafeDumper', data: 'DaemonDescription'):
+ return dumper.represent_dict(data.to_json().items())
+
+
+yaml.add_representer(ServiceDescription, ServiceDescription.yaml_representer)
+
class InventoryFilter(object):
"""