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"