Skip to content

Commit

Permalink
Merge pull request #654 from Icinga:fix/sync_repo_not_saving_ssh_sett…
Browse files Browse the repository at this point in the history
…ings

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
  • Loading branch information
LordHepipud authored Jul 24, 2023
2 parents eb87a5a + 0b2fa0d commit 351f758
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/100-General/10-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#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
* [#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)
* [#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
* [#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
* [#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
* [#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
* [#621](https://github.com/Icinga/icinga-powershell-framework/pull/621) Fixes `-ThresholdInterval` key detection on newer systems
Expand Down
10 changes: 7 additions & 3 deletions lib/core/repository/Sync-IcingaRepository.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,17 @@ function Sync-IcingaRepository()

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

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

if ($Result.ExitCode -ne 0) {
Write-IcingaConsoleError 'SCP Error while copying repository files: {0}' -Objects $Result.Error;
& scp -r "$CopySource" "$SSHRemotePath";

if ($LASTEXITCODE -ne 0) {
Write-IcingaConsoleError 'SCP Error while copying repository files';
$Success = Remove-Item -Path $TmpDir -Recurse -Force;
return;
}

$Path = $SSHRemotePath;
}

$Success = Remove-Item -Path $TmpDir -Recurse -Force;
Expand Down

0 comments on commit 351f758

Please sign in to comment.