File tree 3 files changed +14
-2
lines changed
cli/services/configurators
3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 20
20
from dstack ._internal .core .errors import (
21
21
CLIError ,
22
22
ConfigurationError ,
23
+ MethodNotAllowedError ,
23
24
ResourceNotExistsError ,
24
25
ServerClientError ,
25
26
URLNotFoundError ,
@@ -367,7 +368,7 @@ def _apply_plan(api: Client, plan: FleetPlan) -> Fleet:
367
368
project_name = api .project ,
368
369
plan = plan ,
369
370
)
370
- except URLNotFoundError :
371
+ except ( URLNotFoundError , MethodNotAllowedError ) :
371
372
# TODO: Remove in 0.20
372
373
return api .client .fleets .create (
373
374
project_name = api .project ,
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ class URLNotFoundError(ClientError):
22
22
pass
23
23
24
24
25
+ class MethodNotAllowedError (ClientError ):
26
+ pass
27
+
28
+
25
29
class ServerClientErrorCode (str , enum .Enum ):
26
30
UNSPECIFIED_ERROR = "error"
27
31
RESOURCE_EXISTS = "resource_exists"
Original file line number Diff line number Diff line change 6
6
import requests
7
7
8
8
from dstack import version
9
- from dstack ._internal .core .errors import ClientError , ServerClientError , URLNotFoundError
9
+ from dstack ._internal .core .errors import (
10
+ ClientError ,
11
+ MethodNotAllowedError ,
12
+ ServerClientError ,
13
+ URLNotFoundError ,
14
+ )
10
15
from dstack ._internal .utils .logging import get_logger
11
16
from dstack .api .server ._backends import BackendsAPIClient
12
17
from dstack .api .server ._fleets import FleetsAPIClient
@@ -156,6 +161,8 @@ def _request(
156
161
)
157
162
if resp .status_code == 404 :
158
163
raise URLNotFoundError (f"Status code 404 when requesting { resp .request .url } " )
164
+ if resp .status_code == 405 :
165
+ raise MethodNotAllowedError (f"Status code 405 when requesting { resp .request .url } " )
159
166
if 400 <= resp .status_code < 600 :
160
167
raise ClientError (
161
168
f"Unexpected error: status code { resp .status_code } "
You can’t perform that action at this time.
0 commit comments