mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Simpler fetching of failed/succeeded hooks in CustomBackupMethod
This commit is contained in:
parent
88b7d77610
commit
5516e96d07
1 changed files with 8 additions and 3 deletions
|
@ -1941,7 +1941,8 @@ class CustomBackupMethod(BackupMethod):
|
||||||
|
|
||||||
ret = hook_callback('backup_method', [self.method],
|
ret = hook_callback('backup_method', [self.method],
|
||||||
args=self._get_args('need_mount'))
|
args=self._get_args('need_mount'))
|
||||||
ret_succeed = {k: val for k, val in {n: [p for p, c in v.items() if c['state'] == "succeed"] for n, v in ret.items()}.items() if val}
|
ret_succeed = [hook for hook, infos in ret.items()
|
||||||
|
if any(result["state"] == "succeed" for result in infos.values())]
|
||||||
self._need_mount = True if ret_succeed else False
|
self._need_mount = True if ret_succeed else False
|
||||||
return self._need_mount
|
return self._need_mount
|
||||||
|
|
||||||
|
@ -1955,7 +1956,9 @@ class CustomBackupMethod(BackupMethod):
|
||||||
|
|
||||||
ret = hook_callback('backup_method', [self.method],
|
ret = hook_callback('backup_method', [self.method],
|
||||||
args=self._get_args('backup'))
|
args=self._get_args('backup'))
|
||||||
ret_failed = {k: val for k, val in {n: [p for p, c in v.items() if c['state'] == "failed"] for n, v in ret.items()}.items() if val}
|
|
||||||
|
ret_failed = [hook for hook, infos in ret.items()
|
||||||
|
if any(result["state"] == "failed" for result in infos.values())]
|
||||||
if ret_failed:
|
if ret_failed:
|
||||||
raise YunohostError('backup_custom_backup_error')
|
raise YunohostError('backup_custom_backup_error')
|
||||||
|
|
||||||
|
@ -1969,7 +1972,9 @@ class CustomBackupMethod(BackupMethod):
|
||||||
super(CustomBackupMethod, self).mount(restore_manager)
|
super(CustomBackupMethod, self).mount(restore_manager)
|
||||||
ret = hook_callback('backup_method', [self.method],
|
ret = hook_callback('backup_method', [self.method],
|
||||||
args=self._get_args('mount'))
|
args=self._get_args('mount'))
|
||||||
ret_failed = {k: val for k, val in {n: [p for p, c in v.items() if c['state'] == "failed"] for n, v in ret.items()}.items() if val}
|
|
||||||
|
ret_failed = [hook for hook, infos in ret.items()
|
||||||
|
if any(result["state"] == "failed" for result in infos.values())]
|
||||||
if ret_failed:
|
if ret_failed:
|
||||||
raise YunohostError('backup_custom_mount_error')
|
raise YunohostError('backup_custom_mount_error')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue