mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
Fixes an exception for the windowseventlog feature of the Agent, in case it is not installed
This commit is contained in:
parent
14193afa0b
commit
7077742709
2 changed files with 10 additions and 1 deletions
|
|
@ -13,6 +13,8 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
|
||||
### Bugfixes
|
||||
|
||||
* [#752](https://github.com/Icinga/icinga-powershell-framework/pull/752) Fixes an exception for the windowseventlog feature of the Icinga Agent, in case it is not installed.
|
||||
|
||||
### Enhancements
|
||||
|
||||
## 1.13.0 Beta-1 (2024-08-30)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,13 @@ function Write-IcingaAgentEventLogConfig()
|
|||
[string]$Severity = 'information'
|
||||
);
|
||||
|
||||
[string]$FilePath = (Join-Path -Path (Get-IcingaAgentConfigDirectory) -ChildPath 'features-available\windowseventlog.conf');
|
||||
|
||||
if ((Test-Path -Path $FilePath) -eq $FALSE) {
|
||||
Write-IcingaConsoleNotice 'Windows Eventlog configuration for the Icinga Agent was not written. Either the Icinga Agent is not installed or your installed version does not support this feature';
|
||||
return;
|
||||
}
|
||||
|
||||
$EventLogConf = New-Object System.Text.StringBuilder;
|
||||
|
||||
$EventLogConf.AppendLine('/**') | Out-Null;
|
||||
|
|
@ -33,6 +40,6 @@ function Write-IcingaAgentEventLogConfig()
|
|||
$EventLogConf.AppendLine([string]::Format(' severity = "{0}"', $Severity)) | Out-Null;
|
||||
$EventLogConf.Append('}') | Out-Null;
|
||||
|
||||
Write-IcingaFileSecure -File (Join-Path -Path (Get-IcingaAgentConfigDirectory) -ChildPath 'features-available\windowseventlog.conf') -Value $EventLogConf.ToString();
|
||||
Write-IcingaFileSecure -File $FilePath -Value $EventLogConf.ToString();
|
||||
Write-IcingaConsoleNotice 'Windows Eventlog configuration has been written successfully to use severity level: {0} - Please restart the Icinga Agent to apply this change' -Objects $Severity;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue