Skip to content

Commit 3f6d589

Browse files
authored
Merge pull request #634 from Icinga:fix/clear-host_can_cause_exceptions_during_automation
Fix: Clear-Host throwing exceptions during automation tasks Fixes an issue with `Clear-Host` which could cause an exception during certain automation tasks, causing it to fail
2 parents f028ade + 7d59af9 commit 3f6d589

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

doc/100-General/10-Changelog.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2020
* [#615](https://github.com/Icinga/icinga-powershell-framework/issues/615) Fixes the framework migration tasks which fails in case multiple versions of the framework are installed, printing warnings in case there is
2121
* [#617](https://github.com/Icinga/icinga-powershell-framework/issues/617) Fixes failing calls for plugins which use a switch argument like `-NoPerfData`, which is followed directly by the `-ThresholdInterval` argument
2222
* [#621](https://github.com/Icinga/icinga-powershell-framework/pull/621) Fixes `-ThresholdInterval` key detection on newer systems
23+
* [#634](https://github.com/Icinga/icinga-powershell-framework/pull/634) Fixes an issue with `Clear-Host` which could cause an exception during certain automation tasks, causing it to fail
2324
* [#645](https://github.com/Icinga/icinga-powershell-framework/pull/645) Fixes error and exception handling while using API-Checks, which now will in most cases always return a proper check-result object and also abort while running into plugin execution errors, in case a server is not reachable by the time sync plugin for example
2425
* [#646](https://github.com/Icinga/icinga-powershell-framework/pull/646) Fixes REST-Api to allow arguments for check execution with and without leading `-`
2526
* [#648](https://github.com/Icinga/icinga-powershell-framework/pull/648) Fixes some memory management while using the REST-Api to clear connection objects once they are no longer required
@@ -29,6 +30,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2930
* [#544](https://github.com/Icinga/icinga-powershell-framework/issues/544) Adds support to configure the Icinga Director JSON string for registering hosts via self-service API
3031
* [#572](https://github.com/Icinga/icinga-powershell-framework/issues/572) Adds support to write the name of the repository synced/created into the local `ifw.repo.json` file
3132
* [#573](https://github.com/Icinga/icinga-powershell-framework/issues/573) Adds support to run command `icinga` with new argument `-NoNewInstance`, to use `-RebuildCache` as example to update the current PowerShell instance with all applied changes
33+
* [#613](https://github.com/Icinga/icinga-powershell-framework/pull/613) Adds a `-Version` parameter to the `Update-Icinga` command, to be able to update a component to a specified version [@log1-c]
3234
* [#619](https://github.com/Icinga/icinga-powershell-framework/pull/619) Adds feature to securely read enum provider values with new function `Get-IcingaProviderEnumData`
3335
* [#623](https://github.com/Icinga/icinga-powershell-framework/issues/623) Adds support to provide the Icinga service user written as `user@domain`
3436
* [#633](https://github.com/Icinga/icinga-powershell-framework/pull/633) Adds support for Icinga 2.14.0 native Icinga for Windows API communication
@@ -41,10 +43,6 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
4143
* [#655](https://github.com/Icinga/icinga-powershell-framework/pull/655) Adds [IWKB](https://icinga.com/docs/icinga-for-windows/latest/doc/knowledgebase/IWKB000016/) and test/manage Cmdlets for SCOM intercept counters
4244
* [#656](https://github.com/Icinga/icinga-powershell-framework/pull/656) Adds new feature to write document content easier by storing it in memory first and then allowing to write it to disk at once with proper UTF8 encoding
4345

44-
### Enhancements
45-
46-
* [#613](https://github.com/Icinga/icinga-powershell-framework/pull/613) Adds a `-Version` parameter to the `Update-Icinga` command, to be able to update a component to a specified version [@log1-c]
47-
4846
## 1.10.1 (2022-12-20)
4947

5048
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/27?closed=1)

lib/core/installer/Start-IcingaForWindowsInstallation.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Start-IcingaForWindowsInstallation()
55
);
66

77
if ($global:Icinga.InstallWizard.DirectorInstallError -eq $FALSE -And (Get-IcingaFrameworkDebugMode) -eq $FALSE) {
8-
Clear-Host;
8+
Clear-CLIConsole;
99
}
1010

1111
Write-IcingaConsoleNotice 'Starting Icinga for Windows installation';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function Invoke-IcingaForWindowsMenuStartIcingaShell()
22
{
3-
Clear-Host;
3+
Clear-CLIConsole;
44
$global:Icinga.InstallWizard.Closing = $TRUE;
55
Invoke-IcingaCommand -Shell;
66
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function Clear-CLIConsole()
2+
{
3+
try {
4+
Clear-Host -ErrorAction Stop;
5+
} catch {
6+
# Nothing to do
7+
}
8+
}

lib/core/installer/tools/ShowInstallerMenu.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function Show-IcingaForWindowsInstallerMenu()
2323
);
2424

2525
if ($global:Icinga.InstallWizard.DirectorInstallError -eq $FALSE -And (Test-IcingaForWindowsInstallationHeaderPrint) -eq $FALSE -And (Get-IcingaFrameworkDebugMode) -eq $FALSE) {
26-
Clear-Host;
26+
Clear-CLIConsole;
2727
}
2828

2929
$PSCallStack = Get-PSCallStack;
@@ -295,7 +295,7 @@ function Show-IcingaForWindowsInstallerMenu()
295295

296296
switch ($Result) {
297297
'x' {
298-
Clear-Host;
298+
Clear-CLIConsole;
299299
$global:Icinga.InstallWizard.Closing = $TRUE;
300300
return;
301301
};

lib/icinga/plugin/Write-IcingaPluginOutput.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Write-IcingaPluginOutput()
66

77
if ($Global:Icinga.Protected.RunAsDaemon -eq $FALSE -And $Global:Icinga.Protected.JEAContext -eq $FALSE) {
88
if ($Global:Icinga.Protected.Minimal) {
9-
Clear-Host;
9+
Clear-CLIConsole;
1010
}
1111
Write-IcingaConsolePlain $Output;
1212
} else {

0 commit comments

Comments
 (0)