mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
Fixes exceptions in certain cases while trying to stop the JEA process
This commit is contained in:
parent
a2ba3124e5
commit
e7356a71ac
4 changed files with 39 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
### Bugfixes
|
||||
|
||||
* [#683](https://github.com/Icinga/icinga-powershell-framework/pull/683) Fixes JEA installer to exclude domain from user name length check, which can easily exceed the Windows 20 digits username limit
|
||||
* [#685](https://github.com/Icinga/icinga-powershell-framework/pull/685) Fixes an issue while trying to stop the JEA process in certain cases, which results in an error during installation but has no other effect on the environment
|
||||
* [#686](https://github.com/Icinga/icinga-powershell-framework/pull/686) Fixes certutil error handling and message output in case the icingaforwindows.pfx could not be created
|
||||
|
||||
### Enhancements
|
||||
|
|
|
|||
|
|
@ -7,5 +7,9 @@ function Get-IcingaJEAServicePid()
|
|||
$JeaPid = $JeaPid.Replace("`r`n", '').Replace("`n", '').Replace(' ', '');
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrEmpty($JeaPid) -Or $JeaPid -eq '0' -Or $JeaPid -eq 0) {
|
||||
return $null;
|
||||
}
|
||||
|
||||
return $JeaPid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function Restart-IcingaWindowsService()
|
|||
Stop-IcingaService -Service 'icingapowershell';
|
||||
|
||||
if ((Test-IcingaJEAServiceRunning -JeaPid $JeaPid)) {
|
||||
Stop-Process -Id $JeaPid -Force;
|
||||
Stop-IcingaJEAProcess -JeaPid $JeaPid;
|
||||
}
|
||||
|
||||
Restart-IcingaService -Service 'icingapowershell';
|
||||
|
|
|
|||
33
lib/core/windows/Stop-IcingaJEAProcess.psm1
Normal file
33
lib/core/windows/Stop-IcingaJEAProcess.psm1
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
function Stop-IcingaJEAProcess()
|
||||
{
|
||||
param (
|
||||
[string]$JeaPid = $null
|
||||
);
|
||||
|
||||
if ([string]::IsNullOrEmpty($JeaPid)) {
|
||||
[string]$JeaPid = Get-IcingaJEAServicePid;
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrEmpty($JeaPid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($JeaPid -eq '0' -Or $JeaPid -eq 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$JeaPowerShellProcess = Get-Process -Id $JeaPid -ErrorAction SilentlyContinue;
|
||||
if ($null -eq $JeaPowerShellProcess) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($JeaPowerShellProcess.ProcessName -ne 'wsmprovhost') {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Stop-Process -Id $JeaPid -Force -ErrorAction Stop;
|
||||
} catch {
|
||||
Write-IcingaConsoleError 'Unable to stop the JEA process "wsmprovhost" caused by the following error: "{0}".' -Objects $_.Exception.Message;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue