48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
from bundlewrap.utils import error_context
|
|
import os
|
|
from pathlib import Path
|
|
|
|
uberspaceify = libs.uberspace.Uberspaceify()
|
|
|
|
# Lookup other nodes from different path
|
|
bwfiles_base_path = Path(os.environ.get("BWFILES_BASE_PATH", ".")).absolute()
|
|
bwfiles_nodes_dir_path = bwfiles_base_path / "nodes"
|
|
bwfiles_secrets_file_path = bwfiles_base_path / "secrets.json"
|
|
|
|
bws = libs.bwsops.BwSops(bwfiles_secrets_file_path)
|
|
|
|
def generate_default_repos(node_name, username):
|
|
return {
|
|
"main-cyan": {
|
|
"repo_password": bws.get([node_name, "clerie-backup-job-main"]),
|
|
"repo_url": f"https://cyan.backup.clerie.de/{node_name}/main",
|
|
"auth_username": node_name,
|
|
"auth_password": bws.get([node_name, "clerie-backup-target-cyan"]),
|
|
"files": [
|
|
f"/home/{username}",
|
|
f"/var/www/virtual/{username}",
|
|
],
|
|
"excludes": [
|
|
"/home/*/.cache",
|
|
],
|
|
},
|
|
"main-magenta": {
|
|
"repo_password": bws.get([node_name, "clerie-backup-job-main"]),
|
|
"repo_url": f"https://magenta.backup.clerie.de/{node_name}/main",
|
|
"auth_username": node_name,
|
|
"auth_password": bws.get([node_name, "clerie-backup-target-magenta"]),
|
|
"files": [
|
|
f"/home/{username}",
|
|
f"/var/www/virtual/{username}",
|
|
],
|
|
"excludes": [
|
|
"/home/*/.cache",
|
|
],
|
|
},
|
|
}
|
|
|
|
for node_file in sorted(node_file.absolute() for node_file in bwfiles_nodes_dir_path.iterdir() if node_file.is_file() and node_file.suffix == ".py"):
|
|
with error_context(filename=str(node_file)):
|
|
with node_file.open() as f:
|
|
exec(f.read())
|