-
Notifications
You must be signed in to change notification settings - Fork 85
TPT-4428: Change assignments type from dict to list in ip_addresses_assign #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -452,10 +452,10 @@ def ip_addresses_assign(self, assignments, region): | |||||||||||||||||||||||||||||||||||||||||||||
| :param assignments: Any number of assignments to make. See | ||||||||||||||||||||||||||||||||||||||||||||||
| :any:`IPAddress.to` for details on how to construct | ||||||||||||||||||||||||||||||||||||||||||||||
| assignments. | ||||||||||||||||||||||||||||||||||||||||||||||
| :type assignments: dct | ||||||||||||||||||||||||||||||||||||||||||||||
| :type assignments: list | ||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| for a in assignments["assignments"]: | ||||||||||||||||||||||||||||||||||||||||||||||
| for a in assignments: | ||||||||||||||||||||||||||||||||||||||||||||||
| if not "address" in a or not "linode_id" in a: | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+458
to
459
|
||||||||||||||||||||||||||||||||||||||||||||||
| for a in assignments: | |
| if not "address" in a or not "linode_id" in a: | |
| if isinstance(assignments, dict): | |
| if "assignments" in assignments: | |
| assignments = assignments["assignments"] | |
| else: | |
| raise ValueError( | |
| "Invalid assignments payload: expected a list of assignments " | |
| "or a dict containing an 'assignments' key, got {}".format( | |
| assignments | |
| ) | |
| ) | |
| if not isinstance(assignments, list): | |
| raise ValueError( | |
| "Invalid assignments payload: expected a list of assignments, got {}".format( | |
| type(assignments).__name__ | |
| ) | |
| ) | |
| for a in assignments: | |
| if not isinstance(a, dict) or "address" not in a or "linode_id" not in a: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring still says "Any number of assignments to make" but the method now takes a single
listof assignment objects. Please update the wording to reflect the actual expected argument shape to avoid confusing API consumers.