Adds support to write the name of the repo inside the json file

This commit is contained in:
LordHepipud 2023-07-24 23:07:55 +02:00
parent 64c3b46b94
commit 0541fccc85
3 changed files with 8 additions and 0 deletions

View file

@ -25,6 +25,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Enhancements
* [#544](https://github.com/Icinga/icinga-powershell-framework/issues/544) Adds support to configure the Icinga Director JSON string for registering hosts via self-service API
* [#572](https://github.com/Icinga/icinga-powershell-framework/issues/572) Adds support to write the name of the repository synced/created into the local `ifw.repo.json` file
* [#573](https://github.com/Icinga/icinga-powershell-framework/issues/573) Adds support to run command `icinga` with new argument `-NoNewInstance`, to use `-RebuildCache` as example to update the current PowerShell instance with all applied changes
* [#619](https://github.com/Icinga/icinga-powershell-framework/pull/619) Adds feature to securely read enum provider values with new function `Get-IcingaProviderEnumData`
* [#623](https://github.com/Icinga/icinga-powershell-framework/issues/623) Adds support to provide the Icinga service user written as `user@domain`

View file

@ -13,6 +13,7 @@ function New-IcingaRepositoryFile()
$IcingaRepository | Add-Member -MemberType NoteProperty -Name 'Info' -Value (New-Object -TypeName PSObject);
# Info
$IcingaRepository.Info | Add-Member -MemberType NoteProperty -Name 'Name' -Value $Name;
$IcingaRepository.Info | Add-Member -MemberType NoteProperty -Name 'LocalSource' -Value $Path;
$IcingaRepository.Info | Add-Member -MemberType NoteProperty -Name 'RemoteSource' -Value $RemotePath;
$IcingaRepository.Info | Add-Member -MemberType NoteProperty -Name 'Created' -Value ((Get-Date).ToUniversalTime().ToString('yyyy\/MM\/dd HH:mm:ss'));

View file

@ -199,6 +199,12 @@ function Sync-IcingaRepository()
Start-Sleep -Seconds 2;
}
if ((Test-PSCustomObjectMember -PSObject $JsonRepo.Info -Name 'Name') -eq $FALSE) {
$JsonRepo.Info | Add-Member -MemberType NoteProperty -Name 'Name' -Value $Name;
} else {
$JsonRepo.Info.Name = $Name;
}
$JsonRepo.Info.RepoHash = Get-IcingaRepositoryHash -Path $TmpDir;
$JsonRepo.Info.LocalSource = $Path;
$JsonRepo.Info.RemoteSource = $RemotePath;