Skip to content

Commit

Permalink
'databasefile' option for legacy storage backend
Browse files Browse the repository at this point in the history
Fixes NixOS#1472.
  • Loading branch information
abbradar committed Jan 9, 2022
1 parent eb636fb commit 76e158a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nixops/storage/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand All @@ -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.
Expand All @@ -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"
Expand Down

0 comments on commit 76e158a

Please sign in to comment.