Skip to content

Commit

Permalink
Merge pull request #68 from NASA-AMMOS/persistent-configuration-fix
Browse files Browse the repository at this point in the history
Update configurations after clean
  • Loading branch information
Navarro-Jonathan authored Aug 15, 2023
2 parents b5bc573 + 021fa2d commit 80159ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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

0 comments on commit 80159ed

Please sign in to comment.