Repository navigation
fix: Hostnames list parsing function - #73
Merged
Merged
Conversation
pagbrl
force-pushed
the
fix-hostnames-parsing
branch
from
June 14, 2022 10:07
f379a37 to
d0f3951
Compare
pagbrl
force-pushed
the
fix-hostnames-parsing
branch
from
June 24, 2022 08:41
d0f3951 to
9c60a2d
Compare
sewhyte
approved these changes
Jun 29, 2022
sewhyte
left a comment
Collaborator
There was a problem hiding this comment.
I've tested this locally and it has the intended change.
sewhyte
added a commit
that referenced
this pull request
Jan 11, 2024
fix: Hostnames list parsing function
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.
This PR fixes an inconsistency we identified in the SDK (probably a bug).
Currently, passing a list of hostnames to the SDK is not correctly supported. In this example, we assume that it is possible to pass a list to the
hostnamesarg, consistent with what can be done with theipsandegress_portsargs.Code
Api model result :
As we can see, the parsing of the
hostnamesarg is not correct. That is because we're only using the last element of the list to the hostnames in the parsing function, returning a string, not a list. This in turn makes python split the string later (for hostname in hostnameson a string)Here's the api model for this same snippet, with my proposed change :
Now the list is correctly represented in the API model. I have reused the same logic used for the ips.setter method ( (l. 863-869 attack_helpers.py), which I think is the correct one.
This change does not break the current SDK API, rather enforces it. It is still possible to use a
Union[str, list]for this arg.