Exemplo n.º 1
0
 def serialize_snapshot_diff(self, snap_before: dict,
                             snap_after: dict) -> str:
     """
     Override this method to add the prefix.
     """
     modif = rubydiff(snap_before, snap_after)
     modif = '--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\n' + modif
     return modif
Exemplo n.º 2
0
    def serialize_snapshot_diff(self, snap_before: dict,
                                snap_after: dict) -> str:
        """
        Override this method to add the prefix.
        """
        modif = rubydiff(snap_before, snap_after)
        if snap_after is None:
            proper_mac = snap_before.get('mac').upper().replace(":", "-")
            return (
                "---\n"
                "device: Suppression du périphérique {}\n".format(proper_mac))

        modif = 'device: !ruby/hash:ActiveSupport::HashWithIndifferentAccess\n' + modif
        return modif