-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Allow Netbox device modification #53631
Conversation
70da6f0
to
4ac6156
Compare
LGTM |
1 similar comment
LGTM |
Could we get the diff/update pushed into Netbox utils? I would assume these are something we would want to be added to every other module as well. |
Good idea! I'm working on it, will push something tonight. |
This last commit is what I came up with, tell me what you think. I might add some tests tomorrow, that'd be nice. If not, I'll probably do it in another PR. |
That would be great! We have three modules needing approval but are requiring tests and that is something new to me. If you could provide some for this module that I can use for the other, that'd be great! |
bd6e789
to
e713a62
Compare
This comment has been minimized.
This comment has been minimized.
4a820f3
to
1eb00e0
Compare
Yeah no problem, I'll add unit tests. I should have done that in the first place anyway. |
rebuild_merge |
@sweenu this needs rebase. |
@sweenu Sorry about the need to rebase. I went ahead and implemented your changes in some new modules which caused the conflicts. I think the main differences are the raising ValueError on L194-L205. In your rebase, do you mind leaving the |
@NilashishC If 2.8 Alpha is released today - can this still be implemented into 2.8? |
5d3f0ec
to
e0f1e91
Compare
* Add ability to update and existing device * Allow check_mode * Fail when device name is missing * Fail when cannot resolve ID instead of taking ID 1 by default
e0f1e91
to
1110238
Compare
No problem, conflicts resolved :) |
Thanks for those! I'm not sure if my phone isn't tendering correctly, but are there functions duplicated? |
* Add diff output and check_mode to netbox_ip_address * Deduplicate redundant code into netbox_utils
1110238
to
e744c5c
Compare
Sorry indeed, I messed up. |
shipit |
Thanks for all your help with this! I'll probably reach out to you via email to discuss refactoring |
SUMMARY
This PR allows a Netbox device modification on top of the existing creation and deletion actions.
The ability to modify a device introduces risks if there are any mistakes. That is why I also implemented check mode and the diff output.
I also removed some mechanism that used default values silently when the given value was not found (see diff of line 145 in
netbox_utils.py
) in order to make sure a mistake in using the module would raise an error instead of silently setting arbitrary values.ISSUE TYPE
COMPONENT NAME
netbox_device.py