-
Notifications
You must be signed in to change notification settings - Fork 253
nb_inventory - extract serial and asset_tag. #826
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
Conversation
|
I cant tell from the integration test log what needs to be corrected? |
In the folder |
|
My test-fu is not that strong but ... |
I approved the CI checks, as you can see. Sorry, it required manual intervention. |
|
|
||
| def extract_asset_tag(self, host): | ||
| return host.get("asset_tag") | ||
|
|
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.
Shouldn't these be return a default value of None if they are not set? Such as
host.get("serial", None)because we cannot guarantee that the asset tag and serial are set? I see you have changed a lot of the test files and set the values to None, which just means that now all our test data has the serial and asset_tag attributes with None values but I see other instances in this file, like:
site = host.get("site", None)
if not isinstance(site, dict):
# Device has no site
return []Basically, you need to have this code deal with instances where asset_tag and serial are not attributes that get returned from the NetBox API?
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.
Thanks for the feedback. Re: test files I was/am really just fumbling around trying things to get a good CI.
I'll add the default handling and make the test files rational again and see what haps.
This should be the same as the try/except block from 49a5fb0 but ...
serial is not nullable so deploy with "" or actual string value asset_tag is nullable so return None on absence
|
So the pipeline is/was appeased (3.3 seems to have barfed for something runner-related just now) but I am not completely sure about this:
|
|
@rodvand is pretty good about squashing merging things so don't worry about the commit noise while you were learning, we'll take care of it. Nice work on getting things passing |
|
Hi Sean,
Verkewl! Do I need to do anything else re: your change/re-review?
Thanks,
- Bill
…On Tue, Jan 24, 2023 at 11:14 AM Sean M. Collins ***@***.***> wrote:
@rodvand <https://github.com/rodvand> is pretty good about squashing
merging things so don't worry about the commit noise while you were
learning, we'll take care of it.
Nice work on getting things passing
—
Reply to this email directly, view it on GitHub
<#826 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA7Y6RWNCCSDUL4TXFFDZLDWT75VFANCNFSM6AAAAAAQHCASU4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
This looks pretty good to me but I would like some of the other maintainers to weigh in. |
I am trying to package some Ansible PBs for my team and would like to eliminate the dependency on my local fork. Thanks, |
Related Issue
New Behavior
Add
serialandasset_tagextraction tonetbox.netbox.nb_inventoryContrast to Current Behavior
serialandasset_tagare currently not extractedDiscussion: Benefits and Drawbacks
serialandasset_tagare useful for inventory operationsA general facility to request arbitrary fields from devices seems possible but likely overkill
Changes to the Documentation
Proposed Release Note Entry
nb_inventory - add
serialandasset_tagextraction.Double Check
develbranch.