mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Fixed an Orbit MSI installer bug that caused Orbit files not to be removed during uninstallation (#8333)
This commit is contained in:
parent
37233112b2
commit
8b77939494
3 changed files with 46 additions and 7 deletions
43
.github/workflows/fleet-and-orbit.yml
vendored
43
.github/workflows/fleet-and-orbit.yml
vendored
|
|
@ -432,43 +432,72 @@ jobs:
|
|||
Stop-Service -Name $serviceName
|
||||
Start-Sleep -Seconds $orbitMaxTimeToStartAndTeardown
|
||||
Start-Service -Name $serviceName
|
||||
Get-Service -Name $serviceName | %{ if ($_.Status -ne "Running") { throw "Test #1 failed" } }
|
||||
Get-Service -Name $serviceName | %{ if ($_.Status -ne "Running") { throw "Fleet Service test #1 failed" } }
|
||||
|
||||
# Test 2 - Check that the service stops without issues
|
||||
Stop-Service -Name $serviceName
|
||||
Start-Sleep -Seconds $orbitMaxTimeToStartAndTeardown
|
||||
Get-Service -Name $serviceName | %{ if ($_.Status -ne "Stopped") { throw "Test #2 failed" } }
|
||||
Get-Service -Name $serviceName | %{ if ($_.Status -ne "Stopped") { throw "Fleet Service test #2 failed" } }
|
||||
|
||||
#Test 3 - Check that no orbit.exe is running after service stop (updated after graceful shutdown)
|
||||
Start-Service -Name $serviceName
|
||||
Start-Sleep -Seconds $orbitMaxTimeToStartAndTeardown
|
||||
Stop-Service -Name $serviceName
|
||||
Start-Sleep -Seconds ($orbitMaxTimeToStartAndTeardown * 10) # there is an issue with osqueryd runner intertupt that needs to be tracked down
|
||||
Get-Process | %{ if ($_.Name -eq "orbit") { throw "Test #3 failed" } }
|
||||
Get-Process | %{ if ($_.Name -eq "orbit") { throw "Fleet Service test #3 failed" } }
|
||||
|
||||
# Test 4 - Check that service starts in less than 3 secs
|
||||
Start-Job { Start-Service -Name $args[0] } -ArgumentList $serviceName | Out-Null #async operation
|
||||
Start-Sleep -Seconds 3
|
||||
Get-Service -Name $serviceName | %{ if ($_.Status -ne "Running") { throw "Test #4 failed" } }
|
||||
Get-Service -Name $serviceName | %{ if ($_.Status -ne "Running") { throw "Fleet Service test #4 failed" } }
|
||||
|
||||
#Test 5 - Check that service stops in less than $orbitMaxTimeToStartAndTeardown secs
|
||||
Start-Job { Stop-Service -Name $args[0] } -ArgumentList $serviceName | Out-Null #async operation
|
||||
Start-Sleep -Seconds $orbitMaxTimeToStartAndTeardown
|
||||
Get-Service -Name $serviceName | %{ if ($_.Status -ne "Stopped") { throw "Test #5 failed" } }
|
||||
Get-Service -Name $serviceName | %{ if ($_.Status -ne "Stopped") { throw "Fleet Service test #5 failed" } }
|
||||
|
||||
#Test 6 - Check that no osqueryd process is running once service stops (updated after graceful shutdown)
|
||||
Start-Service -Name $serviceName
|
||||
Start-Sleep -Seconds $orbitMaxTimeToStartAndTeardown # orbit takes some time to spawn osquery and desktop app due to update check
|
||||
Stop-Service -Name $serviceName
|
||||
Start-Sleep -Seconds ($orbitMaxTimeToStartAndTeardown * 10) # there is an issue with osqueryd runner intertupt that needs to be tracked down
|
||||
Get-Process | %{ if ($_.Name -eq "osqueryd") { throw "Test #6 failed" } }
|
||||
Get-Process | %{ if ($_.Name -eq "osqueryd") { throw "Fleet Service test #6 failed" } }
|
||||
|
||||
# Test 7 - Check that no fleet-desktop process is running once service stops
|
||||
Start-Service -Name $serviceName
|
||||
Start-Sleep -Seconds $orbitMaxTimeToStartAndTeardown # orbit takes some time to spawn osquery and desktop app due to update check
|
||||
Stop-Service -Name $serviceName
|
||||
Start-Sleep -Seconds ($orbitMaxTimeToStartAndTeardown * 10) # there is an issue with fleet-desktop runner interrupt that needs to be tracked down
|
||||
Get-Process | %{ if ($_.Name -eq "fleet-desktop") { throw "Test #7 failed" } }
|
||||
Get-Process | %{ if ($_.Name -eq "fleet-desktop") { throw "Fleet Service test #7 failed" } }
|
||||
|
||||
- name: MSI Installer Tests
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Tests setup
|
||||
$serviceName = "Fleet osquery"
|
||||
$registryPath = "HKLM:\SOFTWARE\FleetDM\"
|
||||
$installerExecTime = 15
|
||||
|
||||
# Test 1 - Check that there is not Orbit installation folder in programfiles and no registry entries after MSI uninstallation
|
||||
msiexec /x ${{ steps.download.outputs.download-path }}\fleet-osquery.msi /quiet /passive /lv logtest1.txt
|
||||
Start-Sleep -Seconds $installerExecTime
|
||||
if (Test-Path -Path $Env:Programfiles\Orbit) { throw "MSI Installer test #1 failed" }
|
||||
Get-Service -Name $serviceName -ErrorAction SilentlyContinue | %{ if ($_.Name) { throw "MSI Installer test #1 failed" } }
|
||||
if (((Get-ChildItem -Path $registryPath -ErrorAction SilentlyContinue | Measure-Object).Count) -gt 0) { throw "MSI Installer test #1 failed" }
|
||||
|
||||
# Test 2 - Check that Orbit service, installation folder and registry entry are present after installing MSI again
|
||||
msiexec /i ${{ steps.download.outputs.download-path }}\fleet-osquery.msi /quiet /passive /lv logtest2.txt
|
||||
Start-Sleep -Seconds $installerExecTime
|
||||
if (-not (Test-Path -Path $Env:Programfiles\Orbit)) { throw "MSI Installer test #2 failed" }
|
||||
Get-Service -Name $serviceName -ErrorAction SilentlyContinue | %{ if ($_.Status -ne "Running") { throw "MSI Installer test #2 failed" } }
|
||||
if (((Get-ChildItem -Path $registryPath -ErrorAction SilentlyContinue | Measure-Object).Count) -eq 0) { throw "MSI Installer test #2 failed" }
|
||||
|
||||
# Test 3 - Check that there is not Orbit folder in programfiles, no fleet service entry and no registry entries after uninstalling MSI again
|
||||
msiexec /x ${{ steps.download.outputs.download-path }}\fleet-osquery.msi /quiet /passive /lv logtest3.txt
|
||||
Start-Sleep -Seconds $installerExecTime
|
||||
if (Test-Path -Path $Env:Programfiles\Orbit) { throw "MSI Installer test #3 failed" }
|
||||
Get-Service -Name $serviceName -ErrorAction SilentlyContinue | %{ if ($_.Name) { throw "MSI Installer test #3 failed" } }
|
||||
if (((Get-ChildItem -Path $registryPath -ErrorAction SilentlyContinue | Measure-Object).Count) -gt 0) { throw "MSI Installer test #3 failed" }
|
||||
|
||||
- name: Upload Orbit logs
|
||||
if: always()
|
||||
|
|
|
|||
1
changes/bug-3563-msi-does-not-remove-installed-files
Normal file
1
changes/bug-3563-msi-does-not-remove-installed-files
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Fixed an Orbit MSI installer bug that caused Orbit files not to be removed during uninstallation.
|
||||
|
|
@ -26,6 +26,10 @@ var windowsWixTemplate = template.Must(template.New("").Option("missingkey=error
|
|||
|
||||
<Property Id="REINSTALLMODE" Value="amus" />
|
||||
|
||||
<Property Id="APPLICATIONFOLDER">
|
||||
<RegistrySearch Key="SOFTWARE\FleetDM\Orbit" Root="HKLM" Type="raw" Id="APPLICATIONFOLDER_REGSEARCH" Name="Path" />
|
||||
</Property>
|
||||
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
||||
<MajorUpgrade AllowDowngrades="yes" />
|
||||
|
|
@ -38,6 +42,10 @@ var windowsWixTemplate = template.Must(template.New("").Option("missingkey=error
|
|||
<PermissionEx Sddl="O:SYG:SYD:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1200a9;;;BU)" />
|
||||
</CreateFolder>
|
||||
</Component>
|
||||
<Component Id="C_ORBITROOT_REMOVAL" Guid="B7DFD19E-3D2B-4536-A04F-5D4DE90F3863">
|
||||
<RegistryValue Root="HKLM" Key="SOFTWARE\FleetDM\Orbit" Name="Path" Type="string" Value="[ORBITROOT]" KeyPath="yes" />
|
||||
<util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER" />
|
||||
</Component>
|
||||
<Directory Id="ORBITBIN" Name="bin">
|
||||
<Directory Id="ORBITBINORBIT" Name="orbit">
|
||||
<Component Id="C_ORBITBIN" Guid="AF347B4E-B84B-4DD4-9C4D-133BE17B613D">
|
||||
|
|
@ -86,6 +94,7 @@ var windowsWixTemplate = template.Must(template.New("").Option("missingkey=error
|
|||
|
||||
<Feature Id="Orbit" Title="Fleet osquery" Level="1" Display="hidden">
|
||||
<ComponentGroupRef Id="OrbitFiles" />
|
||||
<ComponentRef Id="C_ORBITROOT_REMOVAL" />
|
||||
<ComponentRef Id="C_ORBITBIN" />
|
||||
<ComponentRef Id="C_ORBITROOT" />
|
||||
</Feature>
|
||||
|
|
|
|||
Loading…
Reference in a new issue