From d17ca30e0d72a47fe6279ffd3f25cb17e6d2fd17 Mon Sep 17 00:00:00 2001 From: Aviv Turgeman Date: Mon, 25 Nov 2024 11:49:52 +0200 Subject: [PATCH] CNV-51884: The topology view of nmstate is broken on cnv2.engineering Signed-off-by: Aviv Turgeman --- .github/workflows/on_pull_request.yaml | 3 ++- src/views/states/topology/utils/utils.ts | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml index 920b097..f1e15ec 100644 --- a/.github/workflows/on_pull_request.yaml +++ b/.github/workflows/on_pull_request.yaml @@ -63,7 +63,8 @@ jobs: sudo install kubectl /usr/local/bin/kubectl - name: Install podman run: | - sudo apt-get -y install podman + sudo apt-get update + sudo apt-get -y install podman --fix-missing - name: Create Cluster run: | diff --git a/src/views/states/topology/utils/utils.ts b/src/views/states/topology/utils/utils.ts index 020ad72..1da478b 100644 --- a/src/views/states/topology/utils/utils.ts +++ b/src/views/states/topology/utils/utils.ts @@ -62,10 +62,10 @@ const createNodes = ( const createEdges = (childNodes: NodeModel[]): EdgeModel[] => { const edges: EdgeModel[] = []; - childNodes.forEach((sourceNode) => { + childNodes?.forEach((sourceNode) => { // Find bridge connections if (!isEmpty(sourceNode.data?.bridgePorts)) { - sourceNode.data?.bridgePorts.forEach((port) => { + sourceNode.data?.bridgePorts?.forEach((port) => { const targetNode = childNodes.find( (target) => target.label === port.name && target.id !== sourceNode.id, ); @@ -83,7 +83,7 @@ const createEdges = (childNodes: NodeModel[]): EdgeModel[] => { // Find bond connections if (!isEmpty(sourceNode.data?.vlanBaseInterface)) { - sourceNode.data?.bondPorts.forEach((port) => { + sourceNode.data?.bondPorts?.forEach((port) => { const targetNode = childNodes.find( (target) => target.label === port && target.id !== sourceNode.id, ); @@ -145,7 +145,7 @@ export const transformDataToTopologyModel = ( const nodes: NodeModel[] = []; const edges: EdgeModel[] = []; - data.forEach((nodeState) => { + data?.forEach((nodeState) => { const nnsName = nodeState.metadata.name; const childNodes = createNodes(nnsName, nodeState.status.currentState.interfaces);