From 63674a86eded27f4bbf23ce3e958b850368c4305 Mon Sep 17 00:00:00 2001 From: Luka Racic Date: Wed, 11 Oct 2023 15:33:36 +0200 Subject: [PATCH] Improvements --- checkmk_extensions/agent/robotmk_collector.ps1 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/checkmk_extensions/agent/robotmk_collector.ps1 b/checkmk_extensions/agent/robotmk_collector.ps1 index e3a468cc..6e343022 100644 --- a/checkmk_extensions/agent/robotmk_collector.ps1 +++ b/checkmk_extensions/agent/robotmk_collector.ps1 @@ -2,7 +2,7 @@ Set-StrictMode -Version 3.0 $ErrorActionPreference = "Stop" function Main { - $ConfigPath = DetermineConfigPath -ProvidedPath $args + $ConfigPath = DetermineConfigPath -CommandLineArgs $args Write-Output "<<>>" try { @@ -25,13 +25,14 @@ function Main { function DetermineConfigPath { [OutputType([string])] - param ( - [array]$ProvidedPath + Param ( + [parameter(Mandatory=$true, Position=0)] + [array]$CommandLineArgs ) #If the path is provided as an argument, use it. - if ($ProvidedPath -ne $null -and $ProvidedPath.Count -gt 0) { - return $ProvidedPath[0] + if ($CommandLineArgs -ne $null -and $CommandLineArgs.Count -gt 0) { + return $CommandLineArgs[0] } # If the -ConfigPath parameter is not defined, check the env:MK_CONFDIR environment variable.