From 5fad73b4e780372f7cdf1f5c260a747d02432ef0 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Thu, 18 Aug 2022 14:17:37 +0200 Subject: [PATCH] Fixes Remote Sync clears RemoteSource --- lib/core/repository/Update-IcingaRepository.psm1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/core/repository/Update-IcingaRepository.psm1 b/lib/core/repository/Update-IcingaRepository.psm1 index 5d23651..22836ab 100644 --- a/lib/core/repository/Update-IcingaRepository.psm1 +++ b/lib/core/repository/Update-IcingaRepository.psm1 @@ -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 `