mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes ConvertTo-SecondsFromIcingaThreshold on default int values
Fixes #79
This commit is contained in:
parent
30609b8e8f
commit
c7a2660969
2 changed files with 11 additions and 4 deletions
|
|
@ -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)
|
[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
|
* [#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)
|
## 1.1.2 (2020-07-01)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,13 @@ function ConvertTo-Seconds()
|
||||||
}
|
}
|
||||||
|
|
||||||
[single]$ValueSplitted = $NumberPart;
|
[single]$ValueSplitted = $NumberPart;
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
if ($Negate) {
|
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)
|
[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)
|
$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()
|
function Get-IcingaThresholdsAsSeconds()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue