File tree Expand file tree Collapse file tree 4 files changed +8
-9
lines changed
src/codeflare_sdk/cluster Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ def login(self) -> str:
7474 error_msg = osp .result .err ()
7575 if "The server uses a certificate signed by unknown authority" in error_msg :
7676 return "Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication"
77+ elif "invalid" in error_msg :
78+ raise PermissionError (error_msg )
7779 else :
7880 return error_msg
7981 return response .out ()
@@ -82,7 +84,8 @@ def logout(self) -> str:
8284 """
8385 This function is used to logout of an OpenShift cluster.
8486 """
85- response = oc .invoke ("logout" )
87+ args = [f"--token={ self .token } " , f"--server={ self .server } :6443" ]
88+ response = oc .invoke ("logout" , args )
8689 return response .out ()
8790
8891
Original file line number Diff line number Diff line change @@ -96,9 +96,6 @@ def up(self):
9696 Applies the AppWrapper yaml, pushing the resource request onto
9797 the MCAD queue.
9898 """
99- resp = self .config .auth .login ()
100- if "invalid" in resp :
101- raise PermissionError (resp )
10299 namespace = self .config .namespace
103100 try :
104101 with oc .project (namespace ):
@@ -135,7 +132,6 @@ def down(self):
135132 print ("Cluster not found, have you run cluster.up() yet?" )
136133 else :
137134 raise osp
138- self .config .auth .logout ()
139135
140136 def status (
141137 self , print_to_console : bool = True
Original file line number Diff line number Diff line change @@ -47,4 +47,3 @@ class ClusterConfiguration:
4747 instascale : bool = False
4848 envs : dict = field (default_factory = dict )
4949 image : str = "ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103"
50- auth : Authentication = Authentication ()
Original file line number Diff line number Diff line change @@ -121,7 +121,10 @@ def test_token_auth_login_logout(mocker):
121121 "login" ,
122122 ["--token=testtoken" , "--server=testserver:6443" ],
123123 )
124- assert token_auth .logout () == ("logout" ,)
124+ assert token_auth .logout () == (
125+ "logout" ,
126+ ["--token=testtoken" , "--server=testserver:6443" ],
127+ )
125128
126129
127130def test_token_auth_login_tls (mocker ):
@@ -198,7 +201,6 @@ def test_config_creation():
198201 gpu = 7 ,
199202 instascale = True ,
200203 machine_types = ["cpu.small" , "gpu.large" ],
201- auth = TokenAuthentication (token = "testtoken" , server = "testserver" ),
202204 )
203205
204206 assert config .name == "unit-test-cluster" and config .namespace == "ns"
@@ -213,7 +215,6 @@ def test_config_creation():
213215 assert config .template == f"{ parent } /src/codeflare_sdk/templates/new-template.yaml"
214216 assert config .instascale
215217 assert config .machine_types == ["cpu.small" , "gpu.large" ]
216- assert config .auth .__class__ == TokenAuthentication
217218 return config
218219
219220
You can’t perform that action at this time.
0 commit comments