From 76e158a935cb2a4a065cabad399e4d38a429726e Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sun, 9 Jan 2022 11:17:28 +0300 Subject: [PATCH] 'databasefile' option for legacy storage backend Fixes #1472. --- nixops/storage/legacy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nixops/storage/legacy.py b/nixops/storage/legacy.py index fdfa5f44d..87bd90698 100644 --- a/nixops/storage/legacy.py +++ b/nixops/storage/legacy.py @@ -3,11 +3,12 @@ import sys import os import os.path +from typing import Optional from nixops.util import ImmutableValidatedObject class LegacyBackendOptions(ImmutableValidatedObject): - pass + databasefile: Optional[str] class LegacyBackend(StorageBackend[LegacyBackendOptions]): @@ -18,7 +19,7 @@ def options(**kwargs) -> LegacyBackendOptions: return LegacyBackendOptions(**kwargs) def __init__(self, args: LegacyBackendOptions) -> None: - pass + self.args = args # fetchToFile: acquire a lock and download the state file to # the local disk. Note: no arguments will be passed over kwargs. @@ -35,6 +36,9 @@ def state_location(self) -> str: if env_override is not None: return env_override + if self.args.databasefile is not None: + return self.args.databasefile + home_dir = os.environ.get("HOME", "") charon_dir = f"{home_dir}/.charon" nixops_dir = f"{home_dir}/.nixops"