Skip to content

Commit 0541fcc

Browse files
committed
Adds support to write the name of the repo inside the json file
1 parent 64c3b46 commit 0541fcc

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

doc/100-General/10-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2525
### Enhancements
2626

2727
* [#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
28+
* [#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
2829
* [#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
2930
* [#619](https://github.com/Icinga/icinga-powershell-framework/pull/619) Adds feature to securely read enum provider values with new function `Get-IcingaProviderEnumData`
3031
* [#623](https://github.com/Icinga/icinga-powershell-framework/issues/623) Adds support to provide the Icinga service user written as `user@domain`

lib/core/repository/New-IcingaRepositoryFile.psm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function New-IcingaRepositoryFile()
1313
$IcingaRepository | Add-Member -MemberType NoteProperty -Name 'Info' -Value (New-Object -TypeName PSObject);
1414

1515
# Info
16+
$IcingaRepository.Info | Add-Member -MemberType NoteProperty -Name 'Name' -Value $Name;
1617
$IcingaRepository.Info | Add-Member -MemberType NoteProperty -Name 'LocalSource' -Value $Path;
1718
$IcingaRepository.Info | Add-Member -MemberType NoteProperty -Name 'RemoteSource' -Value $RemotePath;
1819
$IcingaRepository.Info | Add-Member -MemberType NoteProperty -Name 'Created' -Value ((Get-Date).ToUniversalTime().ToString('yyyy\/MM\/dd HH:mm:ss'));

lib/core/repository/Sync-IcingaRepository.psm1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ function Sync-IcingaRepository()
199199
Start-Sleep -Seconds 2;
200200
}
201201

202+
if ((Test-PSCustomObjectMember -PSObject $JsonRepo.Info -Name 'Name') -eq $FALSE) {
203+
$JsonRepo.Info | Add-Member -MemberType NoteProperty -Name 'Name' -Value $Name;
204+
} else {
205+
$JsonRepo.Info.Name = $Name;
206+
}
207+
202208
$JsonRepo.Info.RepoHash = Get-IcingaRepositoryHash -Path $TmpDir;
203209
$JsonRepo.Info.LocalSource = $Path;
204210
$JsonRepo.Info.RemoteSource = $RemotePath;

0 commit comments

Comments
 (0)