def getSnapshotDetails(self, snapshot: Snapshot):
        ha = snapshot.getSource(SOURCE_HA)
        sources = []
        for source_key in snapshot.sources:
            source: AbstractSnapshot = snapshot.sources[source_key]
            sources.append({
                'name':
                source.name(),
                'key':
                source_key,
                'size':
                source.size(),
                'retained':
                source.retained(),
                'delete_next':
                snapshot.getPurges().get(source_key) or False
            })

        return {
            'name':
            snapshot.name(),
            'slug':
            snapshot.slug(),
            'size':
            snapshot.sizeString(),
            'status':
            snapshot.status(),
            'date':
            self._time.toLocal(snapshot.date()).strftime("%c"),
            'isPending':
            ha is not None and type(ha) is PendingSnapshot,
            'protected':
            snapshot.protected(),
            'type':
            snapshot.snapshotType(),
            'details':
            snapshot.details(),
            'sources':
            sources,
            'uploadable':
            snapshot.getSource(SOURCE_HA) is None
            and len(snapshot.sources) > 0,
            'restorable':
            snapshot.getSource(SOURCE_HA) is not None,
        }
Example #2
0
 def getSnapshotDetails(self, snapshot: Snapshot):
     drive = snapshot.getSource(SOURCE_GOOGLE_DRIVE)
     ha = snapshot.getSource(SOURCE_HA)
     return {
         'name': snapshot.name(),
         'slug': snapshot.slug(),
         'size': snapshot.sizeString(),
         'status': snapshot.status(),
         'date': self._time.toLocal(snapshot.date()).strftime("%c"),
         'inDrive': drive is not None,
         'inHA': ha is not None,
         'isPending': ha is not None and type(ha) is PendingSnapshot,
         'protected': snapshot.protected(),
         'type': snapshot.snapshotType(),
         'details': snapshot.details(),
         'deleteNextDrive': snapshot.getPurges().get(SOURCE_GOOGLE_DRIVE) or False,
         'deleteNextHa': snapshot.getPurges().get(SOURCE_HA) or False,
         'driveRetain': drive.retained() if drive else False,
         'haRetain': ha.retained() if ha else False
     }
Example #3
0
    def getSnapshotDetails(self, snapshot: Snapshot):
        ha = snapshot.getSource(SOURCE_HA)
        sources = []
        for source_key in snapshot.sources:
            source: AbstractSnapshot = snapshot.sources[source_key]
            sources.append({
                'name':
                source.name(),
                'key':
                source_key,
                'size':
                source.size(),
                'retained':
                source.retained(),
                'delete_next':
                snapshot.getPurges().get(source_key) or False,
                'slug':
                snapshot.slug(),
                'ignored':
                source.ignore(),
            })

        return {
            'name':
            snapshot.name(),
            'slug':
            snapshot.slug(),
            'size':
            snapshot.sizeString(),
            'status':
            snapshot.status(),
            'date':
            self._time.toLocal(snapshot.date()).strftime("%c"),
            'createdAt':
            self._time.formatDelta(snapshot.date()),
            'isPending':
            ha is not None and type(ha) is PendingSnapshot,
            'protected':
            snapshot.protected(),
            'type':
            snapshot.snapshotType(),
            'folders':
            snapshot.details().get("folders", []),
            'addons':
            self.formatAddons(snapshot.details()),
            'sources':
            sources,
            'haVersion':
            snapshot.version(),
            'uploadable':
            snapshot.getSource(SOURCE_HA) is None
            and len(snapshot.sources) > 0,
            'restorable':
            snapshot.getSource(SOURCE_HA) is not None,
            'status_detail':
            snapshot.getStatusDetail(),
            'upload_info':
            snapshot.getUploadInfo(self._time),
            'ignored':
            snapshot.ignore(),
            'timestamp':
            snapshot.date().timestamp(),
        }