Module paracrine.services.redis.check_master
Expand source code
import json
from typing import Dict, List
from ...helpers.config import other_config_file
from .. import wireguard
from . import wipe_old_master
from .common import MASTER_FILE, get_existing_masters, get_master_ip
options = {}
def dependencies():
return [wireguard, wipe_old_master]
def run():
master_ip = get_master_ip()
return {"master_ip": master_ip}
def parse_return(infos: List[Dict]) -> None:
existing_masters = get_existing_masters(True)
existing_masters.append(infos[0]["master_ip"])
master_path = other_config_file(MASTER_FILE)
with open(master_path, "w") as f:
json.dump(existing_masters, f, indent=2)
Functions
def dependencies()
-
Expand source code
def dependencies(): return [wireguard, wipe_old_master]
def parse_return(infos: List[Dict]) ‑> None
-
Expand source code
def parse_return(infos: List[Dict]) -> None: existing_masters = get_existing_masters(True) existing_masters.append(infos[0]["master_ip"]) master_path = other_config_file(MASTER_FILE) with open(master_path, "w") as f: json.dump(existing_masters, f, indent=2)
def run()
-
Expand source code
def run(): master_ip = get_master_ip() return {"master_ip": master_ip}