mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-12-24 07:37:04 +00:00
fix coding error
This commit is contained in:
parent
f0f3c7a442
commit
c3750426df
@ -553,6 +553,23 @@ def write_backup_config(env, newconfig):
|
|||||||
with open(os.path.join(backup_root, 'custom.yaml'), "w") as f:
|
with open(os.path.join(backup_root, 'custom.yaml'), "w") as f:
|
||||||
f.write(rtyaml.dump(newconfig))
|
f.write(rtyaml.dump(newconfig))
|
||||||
|
|
||||||
|
def get_backup_root(env):
|
||||||
|
# Define environment variable used to store backup path
|
||||||
|
backup_root_env = "BACKUP_ROOT"
|
||||||
|
|
||||||
|
# Read STORAGE_ROOT
|
||||||
|
backup_root = env["STORAGE_ROOT"]
|
||||||
|
|
||||||
|
# If BACKUP_ROOT exists, overwrite backup_root variable
|
||||||
|
if backup_root_env in env:
|
||||||
|
tmp = env[backup_root_env]
|
||||||
|
if tmp and os.path.isdir(tmp):
|
||||||
|
backup_root = tmp
|
||||||
|
|
||||||
|
backup_root = os.path.join(backup_root, 'backup')
|
||||||
|
|
||||||
|
return backup_root
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
if sys.argv[-1] == "--verify":
|
if sys.argv[-1] == "--verify":
|
||||||
@ -582,19 +599,3 @@ if __name__ == "__main__":
|
|||||||
full_backup = "--full" in sys.argv
|
full_backup = "--full" in sys.argv
|
||||||
perform_backup(full_backup)
|
perform_backup(full_backup)
|
||||||
|
|
||||||
def get_backup_root(env):
|
|
||||||
# Define environment variable used to store backup path
|
|
||||||
backup_root_env = "BACKUP_ROOT"
|
|
||||||
|
|
||||||
# Read STORAGE_ROOT
|
|
||||||
backup_root = env["STORAGE_ROOT"]
|
|
||||||
|
|
||||||
# If BACKUP_ROOT exists, overwrite backup_root variable
|
|
||||||
if backup_root_env in env:
|
|
||||||
tmp = env[backup_root_env]
|
|
||||||
if not tmp && os.path.isdir(tmp):
|
|
||||||
backup_root = tmp
|
|
||||||
|
|
||||||
backup_root = os.path.join(backup_root, 'backup')
|
|
||||||
|
|
||||||
return backup_root
|
|
||||||
|
Loading…
Reference in New Issue
Block a user