Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def process_result(self, result):
if result['returncode'] == 0:
new_repo, created = RepoModel.get_or_create(
url=result['params']['repo_url'],
defaults={
'encryption': result['params']['encryption'],
'extra_borg_arguments': result['params']['extra_borg_arguments'],
}
)
if new_repo.encryption != 'none':
keyring.set_password("vorta-repo", new_repo.url, result['params']['password'])
new_repo.save()
def process_result(self, result):
if result['returncode'] == 0:
new_repo, _ = RepoModel.get_or_create(
url=result['cmd'][-1]
)
if 'cache' in result['data']:
stats = result['data']['cache']['stats']
new_repo.total_size = stats['total_size']
new_repo.unique_csize = stats['unique_csize']
new_repo.unique_size = stats['unique_size']
new_repo.total_unique_chunks = stats['total_unique_chunks']
if 'encryption' in result['data']:
new_repo.encryption = result['data']['encryption']['mode']
if new_repo.encryption != 'none':
keyring.set_password("vorta-repo", new_repo.url, result['params']['password'])
new_repo.extra_borg_arguments = result['params']['extra_borg_arguments']
new_repo.save()
def process_result(self, result):
if result['returncode'] == 0:
repo, created = RepoModel.get_or_create(url=result['cmd'][-1])
if not result['data']:
result['data'] = {} # TODO: Workaround for tests. Can't read mock results 2x.
remote_archives = result['data'].get('archives', [])
# Delete archives that don't exist on the remote side
for archive in ArchiveModel.select().where(ArchiveModel.repo == repo.id):
if not list(filter(lambda s: s['id'] == archive.snapshot_id, remote_archives)):
archive.delete_instance()
# Add remote archives we don't have locally.
for archive in result['data'].get('archives', []):
new_archive, _ = ArchiveModel.get_or_create(
snapshot_id=archive['id'],
repo=repo.id,
defaults={
'name': archive['name'],