def list(self, volume): """ Find all manifest in local cache, and running backups """ results = {} # Might be a backup running for this volume not yet in the manifest running = self._is_a_backup_running(volume['id']) if running: results.update({running['id']: 'RUNNING'}) try: manifest_file = Worker.build_lock_path(self.run_dir, volume['id']) manifest = read_local_manifest(manifest_file) except ManifestEmptyError: return results for backup_id in manifest.backups: if self._backup_is_running(volume['id'], backup_id): job = self.get(volume, backup_id) job['ts'] = manifest.backups.get(backup_id) manifest.backups[backup_id] = job results.update(manifest.backups) return results
def _get_backups(self, helper, id, file, deleted=False): results = [] try: # Attempt to get a listing of the backups for this volume volume = helper.volumes.get(id) for key, value in helper.backups.list(volume).items(): # For each of the backups create an row results.append({ 'volume': volume['id'], 'backup': key, 'timestamp': value }) return results except NotFound: # Include deleted volumes in the list? if not deleted: return [] try: # Read the manifest file of the deleted volume backups = read_local_manifest(file).backups except ManifestEmptyError: backups = {'(manifest is empty)': '0'} # For each of the backups create an row for key, value in backups.items(): results.append({ 'volume': id + " (deleted)", 'backup': key, 'timestamp': value }) return results
def _get_backups(self, helper, id, file, deleted=False): results = [] try: # Attempt to get a listing of the backups for this volume volume = helper.volumes.get(id) for key, value in helper.backups.list(volume).items(): # For each of the backups create an row results.append({'volume': volume['id'], 'backup': key, 'timestamp': value}) return results except NotFound: # Include deleted volumes in the list? if not deleted: return [] try: # Read the manifest file of the deleted volume backups = read_local_manifest(file).backups except ManifestEmptyError: backups = {'(manifest is empty)': '0'} # For each of the backups create an row for key, value in backups.items(): results.append({'volume': id + " (deleted)", 'backup': key, 'timestamp': value}) return results
def list(self, volume): """ Find all manifest in local cache, and running backups """ results = {} # Might be a backup running for this volume not yet in the manifest running = self._is_a_backup_running(volume['id']) if running: results.update({running['id']: 'RUNNING'}) try: manifest_file = Worker.build_lock_path(self.run_dir, volume['id']) manifest = read_local_manifest(manifest_file) except ManifestEmptyError: return results for backup_id in manifest.backups: if self._backup_is_running(volume['id'], backup_id): job = self.get(volume, backup_id) job['ts'] = manifest.backups.get(backup_id) manifest.backups[backup_id] = job results.update(manifest.backups) return results