File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
cli/services/configurators Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 2020from dstack ._internal .core .errors import (
2121 CLIError ,
2222 ConfigurationError ,
23+ MethodNotAllowedError ,
2324 ResourceNotExistsError ,
2425 ServerClientError ,
2526 URLNotFoundError ,
@@ -367,7 +368,7 @@ def _apply_plan(api: Client, plan: FleetPlan) -> Fleet:
367368 project_name = api .project ,
368369 plan = plan ,
369370 )
370- except URLNotFoundError :
371+ except ( URLNotFoundError , MethodNotAllowedError ) :
371372 # TODO: Remove in 0.20
372373 return api .client .fleets .create (
373374 project_name = api .project ,
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ class URLNotFoundError(ClientError):
2222 pass
2323
2424
25+ class MethodNotAllowedError (ClientError ):
26+ pass
27+
28+
2529class ServerClientErrorCode (str , enum .Enum ):
2630 UNSPECIFIED_ERROR = "error"
2731 RESOURCE_EXISTS = "resource_exists"
Original file line number Diff line number Diff line change 66import requests
77
88from 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+ )
1015from dstack ._internal .utils .logging import get_logger
1116from dstack .api .server ._backends import BackendsAPIClient
1217from dstack .api .server ._fleets import FleetsAPIClient
@@ -156,6 +161,8 @@ def _request(
156161 )
157162 if resp .status_code == 404 :
158163 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 } " )
159166 if 400 <= resp .status_code < 600 :
160167 raise ClientError (
161168 f"Unexpected error: status code { resp .status_code } "
You can’t perform that action at this time.
0 commit comments