Skip to content

Commit

Permalink
added -Version parameter to the Update-Icinga` command (#613)
Browse files Browse the repository at this point in the history
* Adds -Version parameter to Update-Icinga for direct update to a specific version
  • Loading branch information
log1-c authored Jul 25, 2023
1 parent 94c6d99 commit 5898ee9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/100-General/10-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions doc/111-Updates-and-Uninstallation/01-Update-Environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
7 changes: 6 additions & 1 deletion lib/core/repository/Update-Icinga.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ function Update-Icinga()
{
param (
[string]$Name = $null,
[string]$Version = $null,
[switch]$Release = $FALSE,
[switch]$Snapshot = $FALSE,
[switch]$Confirm = $FALSE,
Expand All @@ -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;
Expand Down

0 comments on commit 5898ee9

Please sign in to comment.