feat: Add a way to assign a device to a position in a rack#375
Open
kuchosauronad0 wants to merge 1 commit intoSolvik:masterfrom
Open
feat: Add a way to assign a device to a position in a rack#375kuchosauronad0 wants to merge 1 commit intoSolvik:masterfrom
kuchosauronad0 wants to merge 1 commit intoSolvik:masterfrom
Conversation
Before it was only possible to assign a device to a data center and a location within that data center. Now it is also possible to assign it to a position within a location in a data center. There's no error handling, Lets assume that rack exists and the position is free.
Collaborator
|
Hello @kuchosauronad0 and thank you for you contribution ❤️ I saw a couple of undefined vars and missing bits so I assume you're still working on this. I didn't want to annoy you with comments if it's still WIP, so I only made comments about style and structure for now 😁 Feel free to mark your PR as draft until you're finished. And don't hesitate to ask anything you might need to know ! |
ribetm
reviewed
Mar 24, 2025
Comment on lines
+96
to
+100
| driver_value = ( | ||
| ":".join(config.position_location.driver.split(":")[1:]) | ||
| if config.position_location.driver | ||
| else None | ||
| ) |
Collaborator
There was a problem hiding this comment.
Just nitpicking on style but you could use maxsplit
Suggested change
| driver_value = ( | |
| ":".join(config.position_location.driver.split(":")[1:]) | |
| if config.position_location.driver | |
| else None | |
| ) | |
| driver_value = ( | |
| config.position_location.driver.split(":", maxsplit=1)[1] | |
| if config.position_location.driver | |
| else None | |
| ) |
| logging.error("Can't get position if no datacenter is configured or found") | ||
| sys.exit(1) | ||
|
|
||
| return position |
Collaborator
There was a problem hiding this comment.
This function is supposed to return the position currently set in Netbox, rather than the actual, expected one, to be used in the diff checks around lines 480-530.
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.
Before it was only possible to assign a device to a data center and a location within that data center. Now it is also possible to assign it
to a position within a location in a data center. There's no error handling,
Lets assume that rack exists and the position is free.