oVirt/ovirt-web-ui

Blocker: VM Portal crashes at login time when nic.mac is fetched as null instead of undefined, might occur for other endpoints as well

sgratch opened this issue · 4 comments

The following exception appears at login time:

image

We need to handle a case when nic.mac is set to null by backend.
I assume this regression is due to ovirt-engine fix: https://gerrit.ovirt.org/117685

The problem is caused by optional mac node being null instead of undefined (as it was before).
This by-passed the default value used in destructring in

const { mac: { address: nicMacAddress = '' } = {} } = nic

The REST API change impacts all endpoints - compare the response of api/users/<id>/sshpublickeys

Branch 4.4.x

(before migration to com.fasterxml.jackson)

{
  "ssh_public_key" : [ {
    "content" : "ssh-rsa AAAAB3NzaC1yc2EAAA ....",
    "user" : {
      "href" : "/ovirt-engine/api/users/1cdf57d4-1179-11ec-8563-52540012eda2",
      "id" : "1cdf57d4-1179-11ec-8563-52540012eda2"
    },
    "href" : "/ovirt-engine/api/users/1cdf57d4-1179-11ec-8563-52540012eda2/sshpublickeys/3b31acd9-c23a-43e8-ab4a-ad4ede686f96",
    "id" : "3b31acd9-c23a-43e8-ab4a-ad4ede686f96"
  } ]
}

Branch 4.5 (current master)

{
  "ssh_public_key" : [ {
    "content" : "ssh-rsa AAAAB3NzaC1yc2EAAAADAQA.....",
    "user" : {
      "department" : null,
      "domain_entry_id" : null,
      "email" : null,
      "last_name" : null,
      "logged_in" : null,
      "namespace" : null,
      "password" : null,
      "principal" : null,
      "user_name" : null,
      "user_options" : null,
      "domain" : null,
      "groups" : null,
      "options" : null,
      "permissions" : null,
      "roles" : null,
      "ssh_public_keys" : null,
      "tags" : null,
      "actions" : null,
      "name" : null,
      "description" : null,
      "comment" : null,
      "creation_status" : null,
      "link" : null,
      "href" : "/ovirt-engine/api/users/60cce70c-b2a1-11e8-a594-001a4a013f3d",
      "id" : "60cce70c-b2a1-11e8-a594-001a4a013f3d"
    },
    "actions" : null,
    "name" : null,
    "description" : null,
    "comment" : null,
    "creation_status" : null,
    "link" : null,
    "href" : "/ovirt-engine/api/users/60cce70c-b2a1-11e8-a594-001a4a013f3d/sshpublickeys/876990d4-287c-43e9-81a6-cd5ec0fca88a",
    "id" : "876990d4-287c-43e9-81a6-cd5ec0fca88a"
  } ],
  "actions" : null,
  "size" : null,
  "total" : null,
  "active" : null
}

I assume this regression is due to ovirt-engine fix: https://gerrit.ovirt.org/117685

The REST API change seems to be related with patch https://gerrit.ovirt.org/c/ovirt-engine/+/113872

sjd78 commented

Shouldn't this work (untested):

const { mac: { address: nicMacAddress = '' } = {} } = nic ?? {}

The original crash issue was solved and merged by PR#1545 and a bug was opened on infra for handling all other potential cases.
Therefore I'm closing this issue.