Return error when instance added to multiple fleets(#1699)#1938
Merged
r4victor merged 2 commits intodstackai:masterfrom Nov 1, 2024
Merged
Return error when instance added to multiple fleets(#1699)#1938r4victor merged 2 commits intodstackai:masterfrom
r4victor merged 2 commits intodstackai:masterfrom
Conversation
r4victor
reviewed
Nov 1, 2024
Comment on lines
+160
to
+162
| raise ConfigurationValidationError( | ||
| detail=f"Instances [{', '.join(instances_already_in_fleet)}] are already assigned to a fleet." | ||
| ) |
Collaborator
There was a problem hiding this comment.
Please raise ServerClientError("error message"). It will be converted to a 400 response and handled correctly by the CLI. There is no need to introduce new errors.
r4victor
reviewed
Nov 1, 2024
| existing_hosts.add(instance_conn_info.host) | ||
|
|
||
| instances_already_in_fleet = [] | ||
| for new_instance in spec.configuration.ssh_config.hosts: |
Collaborator
There was a problem hiding this comment.
ssh_config.hosts may store hostnames but it may also store structs containing a hostname. You need to handle the second case.
dstack/src/dstack/_internal/core/models/fleets.py
Lines 64 to 69 in 19cd2fd
r4victor
reviewed
Nov 1, 2024
| ) -> FleetPlan: | ||
| # TODO: refactor offers logic into a separate module to avoid depending on runs | ||
|
|
||
| if spec.configuration.ssh_config and spec.configuration.ssh_config.hosts: |
Collaborator
There was a problem hiding this comment.
The entire check should be moved into a separate function like _check_ssh_hosts_not_yet_added()
Contributor
Author
|
Done, please review fixes |
Collaborator
|
@swsvc, merged, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.