Skip to content

Commit 5898ee9

Browse files
authored
added -Version parameter to the Update-Icinga` command (#613)
* Adds -Version parameter to Update-Icinga for direct update to a specific version
1 parent 94c6d99 commit 5898ee9

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

doc/100-General/10-Changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
3939
* [#643](https://github.com/Icinga/icinga-powershell-framework/pull/643) Adds support for `-RebuildCache` flag on `icinga` cmd to rebuild component cache as well
4040
* [#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
4141

42+
### Enhancements
43+
44+
* [#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]
45+
4246
## 1.10.1 (2022-12-20)
4347

4448
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/27?closed=1)

doc/111-Updates-and-Uninstallation/01-Update-Environment.md

+9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The command for updating is `Update-Icinga` and provides the following arguments
1515
| Snapshot | Switch | This will allow to update all components by using snapshot repositories |
1616
| 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 |
1717
| Force | Switch | Allows to re-install components in case the no new version was found with the name version |
18+
| Version | String | Allows to set a specific version to update the package to |
1819

1920
## Updating all components
2021

@@ -36,6 +37,14 @@ Update-Icinga -Name 'plugins;
3637

3738
You have to proceed this step then for all components you want to update.
3839

40+
## Updating a component to a specific version
41+
42+
To update a component to a specific version, you can use the `-Version` argument:
43+
44+
```powershell
45+
Update-Icinga -Name 'plugins -Version '1.10.0';
46+
```
47+
3948
## Pinned components
4049

4150
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.

lib/core/repository/Update-Icinga.psm1

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ function Update-Icinga()
22
{
33
param (
44
[string]$Name = $null,
5+
[string]$Version = $null,
56
[switch]$Release = $FALSE,
67
[switch]$Snapshot = $FALSE,
78
[switch]$Confirm = $FALSE,
@@ -21,7 +22,11 @@ function Update-Icinga()
2122
continue;
2223
}
2324

24-
$NewVersion = $Component.LatestVersion;
25+
if ([string]::IsNullOrEmpty($Version) -eq $FALSE){
26+
$NewVersion = $Component.LatestVersion;
27+
} else {
28+
$NewVersion = $Version;
29+
}
2530

2631
if ([string]::IsNullOrEmpty($NewVersion)) {
2732
Write-IcingaConsoleNotice 'No update package found for component "{0}"' -Objects $entry;

0 commit comments

Comments
 (0)