Adds support to create snapshot repositories with "New-IcingaRepository"

This commit is contained in:
Lord Hepipud 2024-03-12 17:38:01 +01:00
parent c7eeab8dea
commit 01a4a806f3
3 changed files with 9 additions and 6 deletions

View file

@ -20,6 +20,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Enhancements
* [#587](https://github.com/Icinga/icinga-powershell-framework/issues/587) Adds support to create own snapshot repositories with `New-IcingaRepository`
* [#631](https://github.com/Icinga/icinga-powershell-framework/pull/631) Deduplicates `-C try { Use-Icinga ...` boilerplate by adding it to the `PowerShell Base` template and removing it from every single command
* [#679](https://github.com/Icinga/icinga-powershell-framework/pull/679) Adds a new data provider for fetching process information of Windows systems, while sorting all objects based on a process name and their process id
* [#688](https://github.com/Icinga/icinga-powershell-framework/pull/688) Adds new handling to add scheduled tasks in Windows for interacting with Icinga for Windows core functionality as well as an auto renewal task for the Icinga for Windows certificate generation

View file

@ -4,7 +4,8 @@ function New-IcingaRepository()
[string]$Name = $null,
[string]$Path = $null,
[string]$RemotePath = $null,
[switch]$Force = $FALSE
[switch]$Force = $FALSE,
[switch]$Snapshot = $FALSE
);
if ([string]::IsNullOrEmpty($Name)) {
@ -35,7 +36,7 @@ function New-IcingaRepository()
return;
}
$IcingaRepository = New-IcingaRepositoryFile -Path $Path -RemotePath $RemotePath -Name $Name;
$IcingaRepository = New-IcingaRepositoryFile -Path $Path -RemotePath $RemotePath -Name $Name -SnapshotFile:$Snapshot;
[array]$ConfigCount = $IcingaRepository.Packages.PSObject.Properties.Count;

View file

@ -1,9 +1,10 @@
function New-IcingaRepositoryFile()
{
param (
[string]$Path = $null,
[string]$RemotePath = $null,
[string]$Name = ''
[string]$Path = $null,
[string]$RemotePath = $null,
[string]$Name = '',
[switch]$SnapshotFile = $FALSE
);
$RepoFile = 'ifw.repo.json';
@ -57,7 +58,7 @@ function New-IcingaRepositoryFile()
[bool]$IsSnapshot = $FALSE;
if ($entry.FullName.ToLower() -like '*\master.zip') {
if ($entry.FullName.ToLower() -like '*\master.zip' -Or $SnapshotFile) {
$IsSnapshot = $TRUE;
}