nav icon indicating copy to clipboard operation
nav copied to clipboard

Add a report of software upgrade logs

Open johannaengland opened this issue 2 years ago • 10 comments

Closes #2457.

Sub-device id/name and sub-device serial number are still missing.

johannaengland avatar Aug 12 '22 09:08 johannaengland

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Aug 12 '22 09:08 sonarqubecloud[bot]

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.

codecov[bot] avatar Aug 12 '22 10:08 codecov[bot]

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.

github-actions[bot] avatar Aug 12 '22 10:08 github-actions[bot]

Any pointers for the missing information?

johannaengland avatar Oct 31 '22 11:10 johannaengland

The old software version is saved in the varmap. Is there any way to access that?

johannaengland avatar Oct 31 '22 11:10 johannaengland

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

johannaengland avatar Nov 04 '22 08:11 johannaengland

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? :)

lunkwill42 avatar Nov 22 '22 15:11 lunkwill42

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?

johannaengland avatar Nov 25 '22 09:11 johannaengland

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Dec 02 '22 09:12 sonarqubecloud[bot]

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Mar 22 '23 07:03 sonarqubecloud[bot]