added -Version parameter to the Update-Icinga` command (#613)

* Adds -Version parameter to Update-Icinga for direct update to a specific version
This commit is contained in:
log1-c 2023-07-25 15:32:31 +02:00 committed by GitHub
parent 94c6d992fa
commit 5898ee9dcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -39,6 +39,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#643](https://github.com/Icinga/icinga-powershell-framework/pull/643) Adds support for `-RebuildCache` flag on `icinga` cmd to rebuild component cache as well
* [#644](https://github.com/Icinga/icinga-powershell-framework/pull/644) Adds progress bar output to repository interaction (sync, update, new) instead of plain text output
### Enhancements
* [#613](https://github.com/Icinga/icinga-powershell-framework/pull/613) Adds a `-Version` parameter to the `Update-Icinga` command, to be able to update a component to a specified version [@log1-c]
## 1.10.1 (2022-12-20)
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/27?closed=1)

View file

@ -15,6 +15,7 @@ The command for updating is `Update-Icinga` and provides the following arguments
| Snapshot | Switch | This will allow to update all components by using snapshot repositories |
| Confirm | Switch | Each component being updated will ask for a prompt if the package should be updated. Use this switch to confirm the installation and continue |
| Force | Switch | Allows to re-install components in case the no new version was found with the name version |
| Version | String | Allows to set a specific version to update the package to |
## Updating all components
@ -36,6 +37,14 @@ Update-Icinga -Name 'plugins;
You have to proceed this step then for all components you want to update.
## Updating a component to a specific version
To update a component to a specific version, you can use the `-Version` argument:
```powershell
Update-Icinga -Name 'plugins -Version '1.10.0';
```
## Pinned components
If you never want to update a certain component in the near future, you can also [pin components](../120-Repository-Manager/06-Pinning-Versions.md) a certain version. Once you run an update, the component will be ignored in case the pinned version is already installed.

View file

@ -2,6 +2,7 @@ function Update-Icinga()
{
param (
[string]$Name = $null,
[string]$Version = $null,
[switch]$Release = $FALSE,
[switch]$Snapshot = $FALSE,
[switch]$Confirm = $FALSE,
@ -21,7 +22,11 @@ function Update-Icinga()
continue;
}
$NewVersion = $Component.LatestVersion;
if ([string]::IsNullOrEmpty($Version) -eq $FALSE){
$NewVersion = $Component.LatestVersion;
} else {
$NewVersion = $Version;
}
if ([string]::IsNullOrEmpty($NewVersion)) {
Write-IcingaConsoleNotice 'No update package found for component "{0}"' -Objects $entry;