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

Update configurations after clean #68

Merged
merged 4 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/aerie_cli/commands/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,6 @@ def delete_all_files(
return

delete_all_persistent_files()
# Update the PersistentConfigurationManager's cached configurations to account for the clean
PersistentSessionManager.reset()
PersistentConfigurationManager.reset()
17 changes: 17 additions & 0 deletions src/aerie_cli/persistent.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def read_configurations(cls) -> None:
else:
cls._configurations = []

@classmethod
def reset(cls) -> None:
cls._configurations = None


class PersistentSessionManager:
_active_session = None
Expand Down Expand Up @@ -196,6 +200,19 @@ def unset_active_session(cls) -> str:
cls._active_session = None
return name

@classmethod
def reset(cls) -> None:
cls._active_session = None

# Get any/all open sessions. List in chronological order, newest first
fs: List[Path] = [
f for f in SESSION_FILE_DIRECTORY.glob('*.aerie_cli.session')]
if not len(fs):
return
# Delete all session files
for fn in fs:
fn.unlink()


class NoActiveSessionError(Exception):
pass