Adds extended repo management to IMC

This commit is contained in:
Lord Hepipud 2021-08-26 15:11:35 +02:00
parent 8b29f505b3
commit 82bd5f1059
9 changed files with 248 additions and 1 deletions

View file

@ -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 * [#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 * [#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 * [#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) ## 1.5.2 (2021-07-09)

View file

@ -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'
}
}

View file

@ -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'
}
}

View file

@ -12,6 +12,36 @@ function Show-IcingaForWindowsManagementConsoleManageIcingaRepositories()
'Caption' = 'Set Icinga Repository "Icinga Snapshot"'; 'Caption' = 'Set Icinga Repository "Icinga Snapshot"';
'Command' = 'Show-IcingaForWindowsManagementConsoleSetIcingaSnapshotRepositories'; 'Command' = 'Show-IcingaForWindowsManagementConsoleSetIcingaSnapshotRepositories';
'Help' = 'Allows to set the repository URL for the "Icinga Snapshot" repository and will override it, if it already exist'; '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';
} }
); );
} }

View file

@ -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'
}
}

View file

@ -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'
}
}

View file

@ -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'
}
}

View file

@ -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'
}
}

View file

@ -1,6 +1,5 @@
function Show-IcingaForWindowsMenuRemoveComponents() function Show-IcingaForWindowsMenuRemoveComponents()
{ {
[array]$UninstallFeatures = @(); [array]$UninstallFeatures = @();
$AgentInstalled = (Get-IcingaAgentInstallation).Installed; $AgentInstalled = (Get-IcingaAgentInstallation).Installed;
$PowerShellServiceInstalled = Get-Service -Name 'icingapowershell' -ErrorAction SilentlyContinue; $PowerShellServiceInstalled = Get-Service -Name 'icingapowershell' -ErrorAction SilentlyContinue;