From a35ff1994b36cc9bbe365c88911344cc810da201 Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Mon, 28 Oct 2024 16:19:27 -0700 Subject: [PATCH] Quiet warning output if conditions directory doesn't exist --- code/cli/munki/shared/facts.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/cli/munki/shared/facts.swift b/code/cli/munki/shared/facts.swift index 64bfd9e0..23796e0c 100644 --- a/code/cli/munki/shared/facts.swift +++ b/code/cli/munki/shared/facts.swift @@ -96,7 +96,11 @@ func getConditions() async -> PlistDict { let filemanager = FileManager.default try? filemanager.removeItem(atPath: conditionalItemsPath) - if pathExists(conditionalScriptDir), !pathIsDirectory(conditionalScriptDir) { + if !pathExists(conditionalScriptDir) { + return PlistDict() + } + + if !pathIsDirectory(conditionalScriptDir) { displayWarning("\(conditionalScriptDir) exists but is not a directory.") return PlistDict() } @@ -137,7 +141,7 @@ func getConditions() async -> PlistDict { } } else { // could not get script items from dir - displayWarning("Unexpected filesyem issue getting contents of \(conditionalScriptDir)") + displayWarning("Unexpected filesystem issue getting contents of \(conditionalScriptDir)") } return PlistDict() // empty results }