Merge pull request #691 from Icinga:features/adds_support_to_create_snapshot_repositories

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

Adds support to create own snapshot repositories with `New-IcingaRepository`
This commit is contained in:
Lord Hepipud 2024-03-13 16:41:32 +01:00 committed by GitHub
commit 520b03fdc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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
* [#669](https://github.com/Icinga/icinga-powershell-framework/pull/669) Adds new metric to the CPU provider, allowing for distinguishing between the average total load as well as the sum of it
* [#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

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;
}