Uninett / nav

Network Administration Visualized
GNU General Public License v3.0
192 stars 39 forks source link

ipdevpoll inventory job crashes when processing manufacturing dates from ENTITY-MIB under Python 3 #2016

Closed xorr0 closed 5 years ago

xorr0 commented 5 years ago

2019-11-07 16:19:41,793 [ERROR jobs.jobhandler] [inventory 10.30.200.220] Job 'inventory' for 10.30.200.220 aborted: Job aborted due to plugin failure (cause=TypeError("a bytes-like object is required, not 'str'")) 2019-11-07 16:19:41,795 [INFO schedule.netboxjobscheduler] [inventory 10.30.200.220] inventory for 10.30.200.220 failed in 0:09:15.196561. next run in 0:06:38.999982.

- Later, I see the *statuscheck* job errors out as well for the same IP/device (my thought is that this is happening due to the inventory job failing_?_)

2019-11-07 16:26:00,996 [ERROR jobs.jobhandler] [statuscheck 10.30.200.220] Plugin nav.ipdevpoll.plugins.entity.Entity('10.30.200.220') reported an unhandled failure Traceback (most recent call last): File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 500, in errback self._startRunCallbacks(fail) File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 567, in _startRunCallbacks self._runCallbacks() File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 653, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 1442, in gotResult _inlineCallbacks(r, g, deferred) --- --- File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks result = result.throwExceptionIntoGenerator(g) File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/python/failure.py", line 408, in throwExceptionIntoGenerator return g.throw(self.type, self.value, self.tb) File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/plugins/entity.py", line 49, in handle yield self.entitymib.get_entity_physical_table()) File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks result = result.throwExceptionIntoGenerator(g) File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/python/failure.py", line 408, in throwExceptionIntoGenerator return g.throw(self.type, self.value, self.tb) File "/opt/venvs/nav/lib/python3.7/site-packages/nav/mibs/entity_mib.py", line 95, in get_entity_physical_table phy_sensor_table = yield self._get_named_table('entPhysicalTable') File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks result = g.send(result) File "/opt/venvs/nav/lib/python3.7/site-packages/nav/mibs/entity_mib.py", line 89, in _get_named_table named_table = EntityTable(ret_table) File "/opt/venvs/nav/lib/python3.7/site-packages/nav/mibs/entity_mib.py", line 167, in init self.clean() File "/opt/venvs/nav/lib/python3.7/site-packages/nav/mibs/entity_mib.py", line 272, in clean self._parse_mfg_date() File "/opt/venvs/nav/lib/python3.7/site-packages/nav/mibs/entity_mib.py", line 281, in _parse_mfg_date mfg_date = parse_dateandtime_tc(mfg_date) File "/opt/venvs/nav/lib/python3.7/site-packages/nav/mibs/entity_mib.py", line 376, in parse_dateandtime_tc deciseconds) = EIGHT_OCTET_DATEANDTIME.unpack(value[:8]) builtins.TypeError: a bytes-like object is required, not 'str'

2019-11-07 16:26:00,996 [ERROR jobs.jobhandler] [statuscheck 10.30.200.220] Job 'statuscheck' for 10.30.200.220 aborted: Job aborted due to plugin failure (cause=TypeError("a bytes-like object is required, not 'str'")) 2019-11-07 16:26:00,998 [INFO schedule.netboxjobscheduler] [statuscheck 10.30.200.220] statuscheck for 10.30.200.220 failed in 0:09:58.413140. next run in 0:04:59.999982.

- I have 257 of these errors (system uptime for 6hours 32minutes on fresh run of the VM), on MANY different IPs, I believe most are Siklu wireless radio devices.

root@navappliance:/var/log/nav# grep -i "cause=TypeError(\"a bytes-like object is required, not 'str'" ipdevpoll.log | wc -l 257


**To Reproduce**
Steps to reproduce the behavior:
- Exactly as I mentioned, import the device, wait for NAV to do it's thing, and it pops this error.
- When I go to view the IP device at http://${NAV_IP_ADDRESS}/ipdevinfo/10.30.200.220/ I see that the *Inventory* job is listed as *Status: Failed*, and the *Statuscheck* job shows *Status: Overdue*

**Expected behavior**
I hope to get the Inventory job to properly run with these Siklu wireless radio devices, and clear these errors.

**Environment (please complete the following information):**
- NAV version installed: 5.0
- Method of installation: pre-packaged Virtual Appliance, running on Virtual Box

I can provide any additional information required, let me know. Thank you for any assistance.
lunkwill42 commented 5 years ago

Fixed in 508ceb8