Merge pull request #549 from Icinga:fix/remote_repo_sync_remote_path_reset

Fix: Remote Sync clears RemoteSource
This commit is contained in:
Lord Hepipud 2022-08-18 14:18:41 +02:00 committed by GitHub
commit 11deff3403
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,13 +89,21 @@ function Update-IcingaRepository()
continue;
}
# Ensure we use the default RemotePath within our IMC config, unless we specify a different path during update
[string]$SetRemotePath = $definedRepo.Value.RemotePath;
if ([string]::IsNullOrEmpty($RemotePath) -eq $FALSE) {
Set-IcingaPowerShellConfig -Path ([string]::Format('Framework.Repository.Repositories.{0}.RemotePath', $definedRepo.Name)) -Value $RemotePath;
$SetRemotePath = $RemotePath;
}
Write-IcingaConsoleNotice 'Syncing repository "{0}"' -Objects $definedRepo.Name;
if ([string]::IsNullOrEmpty($definedRepo.Value.CloneSource) -eq $FALSE) {
Sync-IcingaRepository `
-Name $definedRepo.Name `
-Path $definedRepo.Value.LocalPath `
-RemotePath $definedRepo.Value.RemotePath `
-RemotePath $SetRemotePath `
-Source $definedRepo.Value.CloneSource `
-UseSCP:$definedRepo.Value.UseSCP `
-Force `