mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Merge pull request #368 from Icinga:fix/repo_lookup_local_path
Fix: Repository lookup on local path for ifw.repo.json Fixes lookup for local ifw.repo.json, in case the path was specified with `ifw.repo.json` included, like `C:\icinga\stable\ifw.repo.json`
This commit is contained in:
commit
78cab91c3a
2 changed files with 16 additions and 2 deletions
|
|
@ -19,6 +19,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
* [#365](https://github.com/Icinga/icinga-powershell-framework/issues/365) Fixes Icinga environment corruption on Icinga Agent installation failure
|
* [#365](https://github.com/Icinga/icinga-powershell-framework/issues/365) Fixes Icinga environment corruption on Icinga Agent installation failure
|
||||||
* [#366](https://github.com/Icinga/icinga-powershell-framework/issues/366) Fixes error handling with Icinga Director over IMC, by printing more detailed and user-friendly error messages
|
* [#366](https://github.com/Icinga/icinga-powershell-framework/issues/366) Fixes error handling with Icinga Director over IMC, by printing more detailed and user-friendly error messages
|
||||||
* [#367](https://github.com/Icinga/icinga-powershell-framework/issues/367) Fixes Icinga Director register state not being saved on overview after registration of Host inside Self-Service API
|
* [#367](https://github.com/Icinga/icinga-powershell-framework/issues/367) Fixes Icinga Director register state not being saved on overview after registration of Host inside Self-Service API
|
||||||
|
* [#368](https://github.com/Icinga/icinga-powershell-framework/issues/368) Fixes repository lookup on local path for ifw.repo.json, in the json file was added to the file path during repository add
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,23 @@ function Read-IcingaRepositoryFile()
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($Repository.LocalPath) -eq $FALSE -And (Test-Path -Path $Repository.LocalPath)) {
|
if ([string]::IsNullOrEmpty($Repository.LocalPath) -eq $FALSE -And (Test-Path -Path $Repository.LocalPath)) {
|
||||||
$RepoPath = $Repository.LocalPath;
|
$RepoPath = $Repository.LocalPath;
|
||||||
$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;
|
||||||
$Content = Get-Content -Path (Join-Path -Path $RepoPath -ChildPath 'ifw.repo.json') -Raw;
|
}
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($RepoPath) -eq $FALSE -And (Test-Path -Path $RepoPath)) {
|
||||||
|
if ([IO.Path]::GetExtension($RepoPath).ToLower() -ne '.json' -And $TryAlternate -eq $FALSE) {
|
||||||
|
return (Read-IcingaRepositoryFile -Name $Name -TryAlternate);
|
||||||
|
} elseif ([IO.Path]::GetExtension($RepoPath).ToLower() -ne '.json' -And $TryAlternat) {
|
||||||
|
Write-IcingaConsoleError 'Unable to read repository file from "{0}" for repository "{1}". No "ifw.repo.json" was found at defined location' -Objects $RepoPath, $Name;
|
||||||
|
return $null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($TryAlternate) {
|
||||||
|
$RepoPath = Join-Path $RepoPath -ChildPath 'ifw.repo.json';
|
||||||
|
}
|
||||||
|
|
||||||
|
$Content = Get-Content -Path $RepoPath -Raw;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$RepoPath = $Repository.RemotePath;
|
$RepoPath = $Repository.RemotePath;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue