Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'databasefile' option for legacy storage backend #1495

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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