fix: move state.json outside install dir to user home /var/tmp

This commit is contained in:
2026-05-22 20:39:24 +04:00
parent e39bbbcad7
commit 684976907d
2 changed files with 4 additions and 2 deletions

View File

@@ -43,6 +43,8 @@ signal.signal(signal.SIGTERM, _handle_sigterm)
def main():
# Инициализируем state сразу, чтобы _LAST_STATE был готов при любом выходе
state.load_state()
parser = argparse.ArgumentParser(description="Docker Service Migration Tool")
parser.add_argument("--mode", choices=["source", "target"], help="Режим работы")
parser.add_argument("--resume", action="store_true", help="Продолжить после ошибки")

View File

@@ -18,10 +18,10 @@ def _state_path():
global STATE_FILE
if STATE_FILE:
return STATE_FILE
# State никогда не храним рядом со скриптом — install.sh его удалит
candidates = [
os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), ".migrate-state.json"),
os.path.join(os.path.expanduser("~"), ".migrate", "state.json"),
"/var/lib/migrate/state.json",
"/var/tmp/docker-migrate/state.json",
]
for c in candidates:
d = os.path.dirname(c)