Icinga / Icinga/icinga-powershell-framework

"update-icinga" of component "service" fails but reports "success"

Open
#857 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Investigation
Dominant language
PowerShell
Stars
87
Forks
34
PR merge metrics
No merged PRs in 30d

Description

The IfW-component has to be updated from version 1.2.0 to 1.3.0.:

Component    Version   Available
---          ---       ---
agent        2.15.2    2.15.2
framework    1.13.5    1.13.5
plugins      1.13.1    1.13.1
service      1.2.0     1.3.0

Try to update in an admin-PS with

update-icinga -confirm

[Notice]: The installed version "1.13.5" of component "framework" is identical or lower than the new version "1.13.5". Use "-Force" to install anyway
[Notice]: The installed version "1.13.1" of component "plugins" is identical or lower than the new version "1.13.1". Use "-Force" to install anyway
[Notice]: The installed version "2.15.2" of component "agent" is identical or lower than the new version "2.15.2". Use "-Force" to install anyway
[Notice]: Downloading "service" from https://mydownloadhost/service/icinga-service-v1.3.0.zip
[Notice]: Installing component "service" into "C:\Program Files\icinga-framework-service\"
[Notice]: Updating Icinga PowerShell Service binary
[Notice]: Waiting for lock on path "C:\Program Files\icinga-framework-service\icinga-service.exe" to be released before trying to remove it
[Error]: Failed to remove items from path "C:\Program Files\icinga-framework-service\icinga-service.exe". Recurse is "False", Force is "True": "System.UnauthorizedAccessException: Access to the path 'C:\Program Files\icinga-framework-service\icinga-service.exe' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileInfo.Delete()
   at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveFileSystemItem(FileSystemInfo fileSystemInfo, Boolean force
)"
[Error]: Failed to copy items from path "C:\Program Files\icinga-framework-service\icinga-service.exe.update" to "C:\Program Files\icinga-framework-service\icinga-service.exe": System.IO.IOException: The process cannot access the file 'C:\Program Files\icinga-framework-service\icinga-service.exe' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   at System.IO.FileInfo.CopyTo(String destFileName, Boolean overwrite)
   at Microsoft.PowerShell.Commands.FileSystemProvider.CopyFileInfoItem(FileInfo file, String destinationPath, Boolean f
orce, PowerShell ps)
   at Microsoft.PowerShell.Commands.FileSystemProvider.CopyItemLocalOrToSession(String path, String destinationPath, Boo
lean recurse, Boolean Force, PowerShell ps)
   at Microsoft.PowerShell.Commands.FileSystemProvider.CopyItem(String path, String destinationPath, Boolean recurse)
   at System.Management.Automation.SessionStateInternal.CopyItem(CmdletProvider providerInstance, String path, String co
pyPath, Boolean recurse, CmdletProviderContext context)
[Notice]: Service User ".\LocalSystem" for service "icingapowershell" successfully updated
[Notice]: Stopping service "icingapowershell"
[Notice]: Starting service "icingapowershell"
[Notice]: Stopping service "icingapowershell"
[Notice]: Service User "NT AUTHORITY\NetworkService" for service "icingapowershell" successfully updated
[Notice]: Successfully set the icinga2 service to delayed autostart
[Notice]: Successfully set the icingapowershell service to delayed autostart
[Notice]: Installation of component "service" was successful

now check the "success":

show-icinga
[...]
Installed components on this system:

Component    Version   Available
---          ---       ---
agent        2.15.2    2.15.2
framework    1.13.5    1.13.5
plugins      1.13.1    1.13.1
service      1.2.0     1.3.0

so once again:

update-icinga -confirm
[Notice]: The installed version "1.13.5" of component "framework" is identical or lower than the new version "1.13.5". Use "-Force" to install anyway
[Notice]: The installed version "1.13.1" of component "plugins" is identical or lower than the new version "1.13.1". Use "-Force" to install anyway
[Notice]: The installed version "2.15.2" of component "agent" is identical or lower than the new version "2.15.2". Use "-Force" to install anyway
[Notice]: Downloading "service" from https://mydownloadhost/service/icinga-service-v1.3.0.zip
[Notice]: Installing component "service" into "C:\Program Files\icinga-framework-service\"
[Notice]: Updating Icinga PowerShell Service binary
[Notice]: Service User ".\LocalSystem" for service "icingapowershell" successfully updated
[Notice]: Stopping service "icingapowershell"
[Notice]: Starting service "icingapowershell"
[Notice]: Stopping service "icingapowershell"
[Notice]: Service User "NT AUTHORITY\NetworkService" for service "icingapowershell" successfully updated
[Notice]: Successfully set the icinga2 service to delayed autostart
[Notice]: Successfully set the icingapowershell service to delayed autostart
[Notice]: Installation of component "service" was successful

this was finally successful:

ls 'C:\Program Files\icinga-framework-service\icinga-service.exe' | % versioninfo

ProductVersion   FileVersion      FileName
--------------   -----------      --------
1.3.0.0          1.3.0.0          C:\Program Files\icinga-framework-service\icinga-service.exe

show-icinga
[...]
Component    Version   Available
---          ---       ---
agent        2.15.2    2.15.2
framework    1.13.5    1.13.5
plugins      1.13.1    1.13.1
service      1.3.0     1.3.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with the update-icinga -confirm and show-icinga entry points, focusing on the failed replacement of icinga-service.exe. Trace how the update command handles the reported deletion and copy errors. Done means a failed service update is reported as failed and the installed and available versions are consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.