Skip to content

Commit 351f758

Browse files
authored
Merge pull request #654 from Icinga:fix/sync_repo_not_saving_ssh_settings
Fix: Sync-IcingaRepository not saving SSH settings Fixes `Sync-IcingaRepository` which did not save the SSH user and host inside the repository configuration, preventing `Update-IcingaRepository` to work properly and added missing scp progress
2 parents eb87a5a + 0b2fa0d commit 351f758

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

doc/100-General/10-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1616
* [#579](https://github.com/Icinga/icinga-powershell-framework/issues/579) Fixes error message during config generation with `Get-IcingaCheckCommandConfig` to make it more clear, in case the custom variables generated are too long for the Icinga Director import
1717
* [#603](https://github.com/Icinga/icinga-powershell-framework/issues/603) Fixes service filter to handle exclude with wildcards instead of requiring the full service name (*not* applying to the display name)
1818
* [#609](https://github.com/Icinga/icinga-powershell-framework/issues/609) Fixes config generator to never use `set_if = true` on Icinga 2/Icinga Director configuration
19+
* [#611](https://github.com/Icinga/icinga-powershell-framework/issues/611) Fixes `Sync-IcingaRepository` which did not save the SSH user and host inside the repository configuration, preventing `Update-IcingaRepository` to work properly and added missing scp progress
1920
* [#615](https://github.com/Icinga/icinga-powershell-framework/issues/615) Fixes the framework migration tasks which fails in case multiple versions of the framework are installed, printing warnings in case there is
2021
* [#617](https://github.com/Icinga/icinga-powershell-framework/issues/617) Fixes failing calls for plugins which use a switch argument like `-NoPerfData`, which is followed directly by the `-ThresholdInterval` argument
2122
* [#621](https://github.com/Icinga/icinga-powershell-framework/pull/621) Fixes `-ThresholdInterval` key detection on newer systems

lib/core/repository/Sync-IcingaRepository.psm1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,17 @@ function Sync-IcingaRepository()
247247

248248
Write-IcingaConsoleNotice 'Syncing new repository files to "{0}"' -Objects $Path;
249249

250-
$Result = Start-IcingaProcess -Executable 'scp' -Arguments ([string]::Format('-r "{0}" "{1}:{2}"', $CopySource, $SSHAuth, $Path));
250+
$SSHRemotePath = ([string]::Format('{0}:{1}', $SSHAuth, $Path));
251251

252-
if ($Result.ExitCode -ne 0) {
253-
Write-IcingaConsoleError 'SCP Error while copying repository files: {0}' -Objects $Result.Error;
252+
& scp -r "$CopySource" "$SSHRemotePath";
253+
254+
if ($LASTEXITCODE -ne 0) {
255+
Write-IcingaConsoleError 'SCP Error while copying repository files';
254256
$Success = Remove-Item -Path $TmpDir -Recurse -Force;
255257
return;
256258
}
259+
260+
$Path = $SSHRemotePath;
257261
}
258262

259263
$Success = Remove-Item -Path $TmpDir -Recurse -Force;

0 commit comments

Comments
 (0)