nav
nav copied to clipboard
Add a report of software upgrade logs
Closes #2457.
Sub-device id/name and sub-device serial number are still missing.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 60.21%. Comparing base (
282694b
) to head (a9f14f2
).
Additional details and impacted files
@@ Coverage Diff @@
## master #2466 +/- ##
=======================================
Coverage 60.21% 60.21%
=======================================
Files 601 601
Lines 43981 43981
=======================================
Hits 26481 26481
Misses 17500 17500
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Test results
12 files 12 suites 11m 34s :stopwatch: 3 318 tests 3 318 :heavy_check_mark: 0 :zzz: 0 :x: 9 429 runs 9 429 :heavy_check_mark: 0 :zzz: 0 :x:
Results for commit a9f14f23.
:recycle: This comment has been updated with latest results.
Any pointers for the missing information?
The old software version is saved in the varmap. Is there any way to access that?
This looks fine to me so far :)
The old software version is saved in the varmap. Is there any way to access that?
I can't recall what the attribute names are. Care to remind me? :)
https://github.com/johannaengland/nav/blob/master/python/nav/ipdevpoll/shadows/init.py#L304
This looks fine to me so far :)
The old software version is saved in the varmap. Is there any way to access that?
I can't recall what the attribute names are. Care to remind me? :)
https://github.com/johannaengland/nav/blob/master/python/nav/ipdevpoll/shadows/init.py#L304
I checked this out, and, unfortunately (as I suspected): varmap items aren't automatically copied over from eventq
to alerthist
entries - which means that this information gets lost in the history log.
An eventengine plugin needs to explicitly copy over variables that we want to keep a historic record of. Otherwise, they're just around for the eventq/alertq for alert profile filter and alert message template expansion.
You can explicitly check the history of upgrade-type alert with something like this:
SELECT
*
FROM
alerthistvar
WHERE
alerthistid IN (
SELECT
ah.alerthistid
FROM
alerthist ah
JOIN alerttype at USING (alerttypeid)
WHERE
alerttype ILIKE '%upgrade'
ORDER BY
start_time DESC
LIMIT 1);
An example of a plugin that copies over the varmap is this plugin (for maintenance events, see line 42 for the defining moment):
https://github.com/Uninett/nav/blob/bec04622364599f81221de24a7a3d11c2a7a722e/python/nav/eventengine/plugins/maintenancestate.py#L37-L46
You can confirm this for maintenance events by re-using the above SQL:
SELECT
*
FROM
alerthistvar
WHERE
alerthistid IN (
SELECT
ah.alerthistid
FROM
alerthist ah
JOIN alerttype at USING (alerttypeid)
WHERE
alerttype ILIKE '%maintenance'
ORDER BY
start_time DESC
LIMIT 1);
So: I think we need a new eventengine plugin before this PR makes sense. Are you up to the task? :)
I have checked this manually in combination with #2515 and it works as expected.
Now only sub-device id/name
and sub-device serial number
are missing, any idea on how to get that?