diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index 9a2997a5..059832c7 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -42,6 +42,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic * [#342](https://github.com/Icinga/icinga-powershell-framework/pull/342) Adds feature to print commands being executed by the Icinga Management Console with `l` and improves summary visualisation for better readability * [#346](https://github.com/Icinga/icinga-powershell-framework/pull/346) Adds support for version names for snapshots * [#348](https://github.com/Icinga/icinga-powershell-framework/pull/348) Improves debug output on TCP handling by separating several network messages into multiple messages and by logging the send message to the client +* [#354](https://github.com/Icinga/icinga-powershell-framework/pull/354) Adds extended Repository management to Icinga Management Console ## 1.5.2 (2021-07-09) diff --git a/lib/core/installer/menu/manage/framework/repository/DisableRepository.psm1 b/lib/core/installer/menu/manage/framework/repository/DisableRepository.psm1 new file mode 100644 index 00000000..1acfd91d --- /dev/null +++ b/lib/core/installer/menu/manage/framework/repository/DisableRepository.psm1 @@ -0,0 +1,37 @@ +function Show-IcingaForWindowsManagementConsoleDisableIcingaRepository() +{ + [array]$Repositories = @(); + [array]$RepoList = Get-IcingaRepositories -ExcludeDisabled; + [int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name; + + foreach ($repo in $RepoList) { + + $PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength; + $PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath); + + $Repositories += @{ + 'Caption' = $PrintName; + 'Command' = 'Show-IcingaForWindowsManagementConsoleDisableIcingaRepository'; + 'Help' = ''; + 'Action' = @{ + 'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog'; + 'Arguments' = @{ + '-Caption' = ([string]::Format('Disable Icinga Repository "{0}"', $repo.Name)); + '-Command' = 'Disable-IcingaRepository'; + '-CmdArguments' = @{ + '-Name' = $repo.Name; + } + } + } + } + } + + if ($Repositories.Count -ne 0) { + Show-IcingaForWindowsInstallerMenu ` + -Header 'Select a repository to disable it from the system' ` + -Entries $Repositories; + } else { + Show-IcingaForWindowsInstallerMenu ` + -Header 'There are no local configured Icinga Repositories' + } +} diff --git a/lib/core/installer/menu/manage/framework/repository/EnableRepository.psm1 b/lib/core/installer/menu/manage/framework/repository/EnableRepository.psm1 new file mode 100644 index 00000000..f43c62c9 --- /dev/null +++ b/lib/core/installer/menu/manage/framework/repository/EnableRepository.psm1 @@ -0,0 +1,41 @@ +function Show-IcingaForWindowsManagementConsoleEnableIcingaRepository() +{ + [array]$Repositories = @(); + [array]$RepoList = Get-IcingaRepositories; + [int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name; + + foreach ($repo in $RepoList) { + + if ($repo.Value.Enabled) { + continue; + } + + $PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength; + $PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath); + + $Repositories += @{ + 'Caption' = $PrintName; + 'Command' = 'Show-IcingaForWindowsManagementConsoleEnableIcingaRepository'; + 'Help' = ''; + 'Action' = @{ + 'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog'; + 'Arguments' = @{ + '-Caption' = ([string]::Format('Enable Icinga Repository "{0}"', $repo.Name)); + '-Command' = 'Enable-IcingaRepository'; + '-CmdArguments' = @{ + '-Name' = $repo.Name; + } + } + } + } + } + + if ($Repositories.Count -ne 0) { + Show-IcingaForWindowsInstallerMenu ` + -Header 'Select a repository to enable it from the system' ` + -Entries $Repositories; + } else { + Show-IcingaForWindowsInstallerMenu ` + -Header 'There are no local configured Icinga Repositories' + } +} diff --git a/lib/core/installer/menu/manage/framework/repository/ManageIcingaRepo.psm1 b/lib/core/installer/menu/manage/framework/repository/ManageIcingaRepo.psm1 index cf9ce18d..883b4e4b 100644 --- a/lib/core/installer/menu/manage/framework/repository/ManageIcingaRepo.psm1 +++ b/lib/core/installer/menu/manage/framework/repository/ManageIcingaRepo.psm1 @@ -12,6 +12,36 @@ function Show-IcingaForWindowsManagementConsoleManageIcingaRepositories() 'Caption' = 'Set Icinga Repository "Icinga Snapshot"'; 'Command' = 'Show-IcingaForWindowsManagementConsoleSetIcingaSnapshotRepositories'; 'Help' = 'Allows to set the repository URL for the "Icinga Snapshot" repository and will override it, if it already exist'; + }, + @{ + 'Caption' = 'Show Icinga Repository list'; + 'Command' = 'Show-IcingaForWindowsManagementConsoleIcingaRepositoriesList'; + 'Help' = 'Shows a list of all defined Icinga Repositories on this machine'; + }, + @{ + 'Caption' = 'Move Icinga Repository to top'; + 'Command' = 'Show-IcingaForWindowsManagementConsolePushIcingaRepository'; + 'Help' = 'Allows you to move certain repositories on the system to the top of the list, which will then be applied first'; + }, + @{ + 'Caption' = 'Move Icinga Repository to bottom'; + 'Command' = 'Show-IcingaForWindowsManagementConsolePopIcingaRepository'; + 'Help' = 'Allows you to move certain repositories on the system to the bottom of the list, which will then be applied last'; + }, + @{ + 'Caption' = 'Enable Icinga Repository'; + 'Command' = 'Show-IcingaForWindowsManagementConsoleEnableIcingaRepository'; + 'Help' = 'Allows you to enable certain repositories on the system'; + }, + @{ + 'Caption' = 'Disable Icinga Repository'; + 'Command' = 'Show-IcingaForWindowsManagementConsoleDisableIcingaRepository'; + 'Help' = 'Allows you to disable certain repositories on the system'; + }, + @{ + 'Caption' = 'Remove Icinga Repository'; + 'Command' = 'Show-IcingaForWindowsManagementConsoleRemoveIcingaRepository'; + 'Help' = 'Allows you to remove certain repositories from the system'; } ); } diff --git a/lib/core/installer/menu/manage/framework/repository/PopRepository.psm1 b/lib/core/installer/menu/manage/framework/repository/PopRepository.psm1 new file mode 100644 index 00000000..0a5a6cd7 --- /dev/null +++ b/lib/core/installer/menu/manage/framework/repository/PopRepository.psm1 @@ -0,0 +1,37 @@ +function Show-IcingaForWindowsManagementConsolePopIcingaRepository() +{ + [array]$Repositories = @(); + [array]$RepoList = Get-IcingaRepositories; + [int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name; + + foreach ($repo in $RepoList) { + + $PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength; + $PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath); + + $Repositories += @{ + 'Caption' = $PrintName; + 'Command' = 'Show-IcingaForWindowsManagementConsolePopIcingaRepository'; + 'Help' = ''; + 'Action' = @{ + 'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog'; + 'Arguments' = @{ + '-Caption' = ([string]::Format('Move Icinga Repository "{0}" to bottom', $repo.Name)); + '-Command' = 'Pop-IcingaRepository'; + '-CmdArguments' = @{ + '-Name' = $repo.Name; + } + } + } + } + } + + if ($Repositories.Count -ne 0) { + Show-IcingaForWindowsInstallerMenu ` + -Header 'Select a repository to move it to the bottom of the list' ` + -Entries $Repositories; + } else { + Show-IcingaForWindowsInstallerMenu ` + -Header 'There are no local configured Icinga Repositories' + } +} diff --git a/lib/core/installer/menu/manage/framework/repository/PushRepository.psm1 b/lib/core/installer/menu/manage/framework/repository/PushRepository.psm1 new file mode 100644 index 00000000..aa8a4df1 --- /dev/null +++ b/lib/core/installer/menu/manage/framework/repository/PushRepository.psm1 @@ -0,0 +1,37 @@ +function Show-IcingaForWindowsManagementConsolePushIcingaRepository() +{ + [array]$Repositories = @(); + [array]$RepoList = Get-IcingaRepositories; + [int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name; + + foreach ($repo in $RepoList) { + + $PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength; + $PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath); + + $Repositories += @{ + 'Caption' = $PrintName; + 'Command' = 'Show-IcingaForWindowsManagementConsolePushIcingaRepository'; + 'Help' = ''; + 'Action' = @{ + 'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog'; + 'Arguments' = @{ + '-Caption' = ([string]::Format('Move Icinga Repository "{0}" to top', $repo.Name)); + '-Command' = 'Push-IcingaRepository'; + '-CmdArguments' = @{ + '-Name' = $repo.Name; + } + } + } + } + } + + if ($Repositories.Count -ne 0) { + Show-IcingaForWindowsInstallerMenu ` + -Header 'Select a repository to move it to the top of the list' ` + -Entries $Repositories; + } else { + Show-IcingaForWindowsInstallerMenu ` + -Header 'There are no local configured Icinga Repositories' + } +} diff --git a/lib/core/installer/menu/manage/framework/repository/RemoveRepository.psm1 b/lib/core/installer/menu/manage/framework/repository/RemoveRepository.psm1 new file mode 100644 index 00000000..4926a113 --- /dev/null +++ b/lib/core/installer/menu/manage/framework/repository/RemoveRepository.psm1 @@ -0,0 +1,37 @@ +function Show-IcingaForWindowsManagementConsoleRemoveIcingaRepository() +{ + [array]$Repositories = @(); + [array]$RepoList = Get-IcingaRepositories; + [int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name; + + foreach ($repo in $RepoList) { + + $PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength; + $PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath); + + $Repositories += @{ + 'Caption' = $PrintName; + 'Command' = 'Show-IcingaForWindowsManagementConsoleRemoveIcingaRepository'; + 'Help' = ''; + 'Action' = @{ + 'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog'; + 'Arguments' = @{ + '-Caption' = ([string]::Format('Remove Icinga Repository "{0}"', $repo.Name)); + '-Command' = 'Remove-IcingaRepository'; + '-CmdArguments' = @{ + '-Name' = $repo.Name; + } + } + } + } + } + + if ($Repositories.Count -ne 0) { + Show-IcingaForWindowsInstallerMenu ` + -Header 'Select a repository to remove it from the system' ` + -Entries $Repositories; + } else { + Show-IcingaForWindowsInstallerMenu ` + -Header 'There are no local configured Icinga Repositories' + } +} diff --git a/lib/core/installer/menu/manage/framework/repository/ShowRepositoryList.psm1 b/lib/core/installer/menu/manage/framework/repository/ShowRepositoryList.psm1 new file mode 100644 index 00000000..74e4ec12 --- /dev/null +++ b/lib/core/installer/menu/manage/framework/repository/ShowRepositoryList.psm1 @@ -0,0 +1,28 @@ +function Show-IcingaForWindowsManagementConsoleIcingaRepositoriesList() +{ + [array]$Repositories = @(); + [array]$RepoList = Get-IcingaRepositories; + [int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name; + + foreach ($repo in $RepoList) { + + $PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength; + $PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath); + + $Repositories += @{ + 'Caption' = $PrintName; + 'Command' = 'Show-IcingaForWindowsManagementConsoleIcingaRepositoriesList'; + 'Help' = ''; + 'Disabled' = (-Not $repo.Value.Enabled); + } + } + + if ($Repositories.Count -ne 0) { + Show-IcingaForWindowsInstallerMenu ` + -Header 'List of local configured Icinga Repositories' ` + -Entries $Repositories; + } else { + Show-IcingaForWindowsInstallerMenu ` + -Header 'There are no local configured Icinga Repositories' + } +} diff --git a/lib/core/installer/menu/manage/general/RemoveComponents.psm1 b/lib/core/installer/menu/manage/general/RemoveComponents.psm1 index 6924dd23..3aeab2b1 100644 --- a/lib/core/installer/menu/manage/general/RemoveComponents.psm1 +++ b/lib/core/installer/menu/manage/general/RemoveComponents.psm1 @@ -1,6 +1,5 @@ function Show-IcingaForWindowsMenuRemoveComponents() { - [array]$UninstallFeatures = @(); $AgentInstalled = (Get-IcingaAgentInstallation).Installed; $PowerShellServiceInstalled = Get-Service -Name 'icingapowershell' -ErrorAction SilentlyContinue;