mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-11-25 23:10:54 +00:00
Merge 75295f95ac into 2d0ca67e85
This commit is contained in:
commit
0c6f0fb3e8
@ -17,6 +17,11 @@ from utils import load_environment, shell, wait_for_service
|
|||||||
import operator
|
import operator
|
||||||
|
|
||||||
def backup_status(env):
|
def backup_status(env):
|
||||||
|
"""
|
||||||
|
TODO: Document what the return value actually is.
|
||||||
|
|
||||||
|
Will raise an exception if the call to the duplicity binary fails.
|
||||||
|
"""
|
||||||
# If backups are disabled, return no status.
|
# If backups are disabled, return no status.
|
||||||
config = get_backup_config(env)
|
config = get_backup_config(env)
|
||||||
if config["target"] == "off":
|
if config["target"] == "off":
|
||||||
@ -65,7 +70,7 @@ def backup_status(env):
|
|||||||
get_duplicity_target_url(config)
|
get_duplicity_target_url(config)
|
||||||
],
|
],
|
||||||
get_duplicity_env_vars(env),
|
get_duplicity_env_vars(env),
|
||||||
trap=True)
|
trap=True, capture_stderr=True)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
# Command failed. This is likely due to an improperly configured remote
|
# Command failed. This is likely due to an improperly configured remote
|
||||||
# destination for the backups or the last backup job terminated unexpectedly.
|
# destination for the backups or the last backup job terminated unexpectedly.
|
||||||
|
|||||||
@ -275,7 +275,11 @@ def check_backup(rounded_values, env, output):
|
|||||||
output.print_ok("Backups are enabled")
|
output.print_ok("Backups are enabled")
|
||||||
|
|
||||||
# Get the age of the most recent backup
|
# Get the age of the most recent backup
|
||||||
backup_stat = backup_status(env)
|
try:
|
||||||
|
backup_stat = backup_status(env)
|
||||||
|
except Exception as e:
|
||||||
|
output.print_error(f"Failed to obtain backup status: {e}")
|
||||||
|
return
|
||||||
|
|
||||||
backups = backup_stat.get("backups", {})
|
backups = backup_stat.get("backups", {})
|
||||||
if backups and len(backups) > 0:
|
if backups and len(backups) > 0:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user