Merge pull request #362 from Icinga:fix/repository_install_fail_fileshare

Fix: Repository component install from file share

The installation from file share locations will fail, in case no `LocalPath` is assigned to the repository configuration and is also failing by invalid escaping of the path.

This is now fixed as the `RemotePath` is the only one being required and in addition downloads from file shares of component packages is now working as intended.
This commit is contained in:
Lord Hepipud 2021-09-09 12:05:27 +02:00 committed by GitHub
commit acbbc4f68b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 3 deletions

View file

@ -14,6 +14,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Bugfixes ### Bugfixes
* [#361](https://github.com/Icinga/icinga-powershell-framework/issues/361) Fixes IMC freeze on Icinga Director Self-Service installation, in case no Agent installation set on Self-Service API config * [#361](https://github.com/Icinga/icinga-powershell-framework/issues/361) Fixes IMC freeze on Icinga Director Self-Service installation, in case no Agent installation set on Self-Service API config
* [#362](https://github.com/Icinga/icinga-powershell-framework/issues/362) Fixes repository component installation from file share locations
## 1.6.0 (2021-09-07) ## 1.6.0 (2021-09-07)

View file

@ -25,7 +25,7 @@ function Read-IcingaRepositoryFile()
$Content = Get-Content -Path (Join-Path -Path $RepoPath -ChildPath 'ifw.repo.json') -Raw; $Content = Get-Content -Path (Join-Path -Path $RepoPath -ChildPath 'ifw.repo.json') -Raw;
} elseif ([string]::IsNullOrEmpty($Repository.RemotePath) -eq $FALSE -And (Test-Path -Path $Repository.RemotePath)) { } elseif ([string]::IsNullOrEmpty($Repository.RemotePath) -eq $FALSE -And (Test-Path -Path $Repository.RemotePath)) {
$RepoPath = $Repository.RemotePath; $RepoPath = $Repository.RemotePath;
$WebContent = Get-Content -Path (Join-Path -Path $RepoPath -ChildPath 'ifw.repo.json') -Raw; $Content = Get-Content -Path (Join-Path -Path $RepoPath -ChildPath 'ifw.repo.json') -Raw;
} else { } else {
try { try {
$RepoPath = $Repository.RemotePath; $RepoPath = $Repository.RemotePath;

View file

@ -77,6 +77,12 @@ function Invoke-IcingaWebRequest()
$Index++; $Index++;
} }
# If our URI is a local path or a file share path, always ensure to use the correct Windows directory
# handling with '\' instead of '/'
if ([string]::IsNullOrEmpty($Uri) -eq $FALSE -And (Test-Path $Uri)) {
$Uri = $Uri.Replace('/', '\');
}
$WebArguments = @{ $WebArguments = @{
'Uri' = $Uri; 'Uri' = $Uri;
'Method' = $Method; 'Method' = $Method;