mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
29 lines
806 B
PowerShell
29 lines
806 B
PowerShell
function Set-IcingaInternalPluginExitCode()
|
|
{
|
|
param (
|
|
$ExitCode = 0
|
|
);
|
|
|
|
if ($null -eq $Global:Icinga) {
|
|
$Global:Icinga = @{ };
|
|
}
|
|
|
|
if ($Global:Icinga.ContainsKey('PluginExecution') -eq $FALSE) {
|
|
$Global:Icinga.Add(
|
|
'PluginExecution',
|
|
@{
|
|
'LastExitCode' = $ExitCode;
|
|
}
|
|
)
|
|
} else {
|
|
if ($Global:Icinga.PluginExecution.ContainsKey('LastExitCode') -eq $FALSE) {
|
|
$Global:Icinga.PluginExecution.Add('LastExitCode', $ExitCode);
|
|
return;
|
|
}
|
|
|
|
# Only add the first exit code we should cover during one runtime
|
|
if ($null -eq $Global:Icinga.PluginExecution.LastExitCode) {
|
|
$Global:Icinga.PluginExecution.LastExitCode = $ExitCode;
|
|
}
|
|
}
|
|
}
|