From 8385fe8e73b6e25cd7ddc0b15dd64afddfa23255 Mon Sep 17 00:00:00 2001 From: olensmar Date: Thu, 30 Sep 2021 15:22:45 +0200 Subject: [PATCH] fix: fixed creation of unsatisfied refs for missing patch files --- src/redux/services/kustomize.ts | 5 +++-- src/redux/services/resource.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/redux/services/kustomize.ts b/src/redux/services/kustomize.ts index 1e79164c56..f9b09998b8 100644 --- a/src/redux/services/kustomize.ts +++ b/src/redux/services/kustomize.ts @@ -101,10 +101,11 @@ function extractPatches( }); } else { log.warn(`No resources in ${refNode.nodeValue()} - creating FileRef to ${kpath}`); - createFileRef(kustomization, refNode, kpath); + createFileRef(kustomization, refNode, kpath, fileMap); } } else { - log.warn(`Failed to find ${patchPath} ${refNode.nodeValue()} in ${kustomization.filePath}`); + // this will create an unsatisfied file ref + createFileRef(kustomization, refNode, kpath, fileMap); } }); } diff --git a/src/redux/services/resource.ts b/src/redux/services/resource.ts index 6192e4af14..88d3ee4ee7 100644 --- a/src/redux/services/resource.ts +++ b/src/redux/services/resource.ts @@ -266,8 +266,8 @@ export function createResourceName(filePath: string, content: any) { * Adds a file ref to the specified file to the specified resource */ -export function createFileRef(resource: K8sResource, refNode: NodeWrapper, filePath: string) { - let refType = ResourceRefType.Outgoing; +export function createFileRef(resource: K8sResource, refNode: NodeWrapper, filePath: string, fileMap: FileMapType) { + let refType = fileMap[filePath] ? ResourceRefType.Outgoing : ResourceRefType.Unsatisfied; resource.refs = resource.refs || []; const refName = (refNode ? refNode.nodeValue() : filePath) || '';