Fixes ConvertTo-SecondsFromIcingaThreshold on default int values

Fixes #79
This commit is contained in:
Christian Stein 2020-07-23 15:32:05 +02:00
parent 30609b8e8f
commit c7a2660969
2 changed files with 11 additions and 4 deletions

View file

@ -12,6 +12,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/7?closed=1)
* [#78](https://github.com/Icinga/icinga-powershell-framework/issues/78) Fix Icinga Agent package fetching for x86 architecture
* [#79](https://github.com/Icinga/icinga-powershell-framework/issues/79) Fix ConvertTo-Seconds to output valid numeric data with multiple digits
## 1.1.2 (2020-07-01)

View file

@ -57,13 +57,13 @@ function ConvertTo-Seconds()
}
[single]$ValueSplitted = $NumberPart;
$result = 0;
$result = 0;
if ($Negate) {
$ValueSplitted *= -1;
$ValueSplitted *= -1;
}
[string]$errorMsg = (
[string]$errorMsg = (
[string]::Format('Invalid unit type "{0}" specified for convertion. Allowed units: ms, s, m, h, d, w, M, y', $UnitPart)
);
@ -105,7 +105,13 @@ function ConvertTo-SecondsFromIcingaThresholds()
$NewContent += (Get-IcingaThresholdsAsSeconds -Value $entry)
}
return [string]::Join(':', $NewContent);
[string]$Value = [string]::Join(':', $NewContent);
if ($Value.Contains(':') -eq $FALSE) {
return [convert]::ToDouble($Value);
}
return $Value;
}
function Get-IcingaThresholdsAsSeconds()