Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
racicLuka committed Oct 11, 2023
1 parent cdae7be commit 63674a8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions checkmk_extensions/agent/robotmk_collector.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Set-StrictMode -Version 3.0
$ErrorActionPreference = "Stop"

function Main {
$ConfigPath = DetermineConfigPath -ProvidedPath $args
$ConfigPath = DetermineConfigPath -CommandLineArgs $args
Write-Output "<<<robotmk_v2:sep(10)>>>"

try {
Expand All @@ -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.
Expand Down

0 comments on commit 63674a8

Please sign in to comment.