File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,6 @@ def select_current_org() -> Organization:
55
55
raise ValueError ()
56
56
57
57
organization = orgs [input_selection - 1 ]
58
- config_manager = get_config_manager ()
59
- config_manager .config .current_org_id = organization .id
60
- config_manager .save_config ()
61
58
print (f"You have selected the organization: { organization .name } " )
62
59
return organization
63
60
except ValueError :
@@ -81,7 +78,11 @@ def main() -> None:
81
78
try :
82
79
if not auth .is_authenticated :
83
80
auth .login ()
84
- select_current_org ()
81
+ organization = select_current_org ()
82
+ config_manager = get_config_manager ()
83
+ config_manager .config .current_org_id = organization .id
84
+ config_manager .save_config ()
85
+
85
86
except AuthenticationError :
86
87
print ("Failed to Authenticate, please try again" )
87
88
except (OrganizationError , InputError ):
Original file line number Diff line number Diff line change 2
2
3
3
from neuracore .core .cli .input_lock import user_input_lock
4
4
from neuracore .core .cli .select_current_org import select_current_org
5
- from neuracore .core .config .config_manager import get_config
5
+ from neuracore .core .config .config_manager import get_config_manager
6
6
from neuracore .core .exceptions import (
7
7
AuthenticationError ,
8
8
ConfigError ,
@@ -23,10 +23,14 @@ def get_current_org() -> str:
23
23
ConfigError: If there is an error trying to get the config
24
24
"""
25
25
with user_input_lock :
26
- org_id = get_config ().current_org_id
26
+ config_manager = get_config_manager ()
27
+ org_id = config_manager .config .current_org_id
27
28
if org_id :
28
29
return org_id
29
30
try :
30
- return select_current_org ().id
31
+ organization = select_current_org ()
32
+ config_manager .config .current_org_id = organization .id
33
+ config_manager .save_config ()
34
+ return organization .id
31
35
except (AuthenticationError , OrganizationError , InputError ) as e :
32
36
raise ConfigError (f"Failed to select organization: { e } " )
You can’t perform that action at this time.
0 commit comments