Skip to content

Commit 82bd5f1

Browse files
committed
Adds extended repo management to IMC
1 parent 8b29f50 commit 82bd5f1

File tree

9 files changed

+248
-1
lines changed

9 files changed

+248
-1
lines changed

doc/31-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
4242
* [#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
4343
* [#346](https://github.com/Icinga/icinga-powershell-framework/pull/346) Adds support for version names for snapshots
4444
* [#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
45+
* [#354](https://github.com/Icinga/icinga-powershell-framework/pull/354) Adds extended Repository management to Icinga Management Console
4546

4647
## 1.5.2 (2021-07-09)
4748

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function Show-IcingaForWindowsManagementConsoleDisableIcingaRepository()
2+
{
3+
[array]$Repositories = @();
4+
[array]$RepoList = Get-IcingaRepositories -ExcludeDisabled;
5+
[int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name;
6+
7+
foreach ($repo in $RepoList) {
8+
9+
$PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength;
10+
$PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath);
11+
12+
$Repositories += @{
13+
'Caption' = $PrintName;
14+
'Command' = 'Show-IcingaForWindowsManagementConsoleDisableIcingaRepository';
15+
'Help' = '';
16+
'Action' = @{
17+
'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog';
18+
'Arguments' = @{
19+
'-Caption' = ([string]::Format('Disable Icinga Repository "{0}"', $repo.Name));
20+
'-Command' = 'Disable-IcingaRepository';
21+
'-CmdArguments' = @{
22+
'-Name' = $repo.Name;
23+
}
24+
}
25+
}
26+
}
27+
}
28+
29+
if ($Repositories.Count -ne 0) {
30+
Show-IcingaForWindowsInstallerMenu `
31+
-Header 'Select a repository to disable it from the system' `
32+
-Entries $Repositories;
33+
} else {
34+
Show-IcingaForWindowsInstallerMenu `
35+
-Header 'There are no local configured Icinga Repositories'
36+
}
37+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
function Show-IcingaForWindowsManagementConsoleEnableIcingaRepository()
2+
{
3+
[array]$Repositories = @();
4+
[array]$RepoList = Get-IcingaRepositories;
5+
[int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name;
6+
7+
foreach ($repo in $RepoList) {
8+
9+
if ($repo.Value.Enabled) {
10+
continue;
11+
}
12+
13+
$PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength;
14+
$PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath);
15+
16+
$Repositories += @{
17+
'Caption' = $PrintName;
18+
'Command' = 'Show-IcingaForWindowsManagementConsoleEnableIcingaRepository';
19+
'Help' = '';
20+
'Action' = @{
21+
'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog';
22+
'Arguments' = @{
23+
'-Caption' = ([string]::Format('Enable Icinga Repository "{0}"', $repo.Name));
24+
'-Command' = 'Enable-IcingaRepository';
25+
'-CmdArguments' = @{
26+
'-Name' = $repo.Name;
27+
}
28+
}
29+
}
30+
}
31+
}
32+
33+
if ($Repositories.Count -ne 0) {
34+
Show-IcingaForWindowsInstallerMenu `
35+
-Header 'Select a repository to enable it from the system' `
36+
-Entries $Repositories;
37+
} else {
38+
Show-IcingaForWindowsInstallerMenu `
39+
-Header 'There are no local configured Icinga Repositories'
40+
}
41+
}

lib/core/installer/menu/manage/framework/repository/ManageIcingaRepo.psm1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,36 @@ function Show-IcingaForWindowsManagementConsoleManageIcingaRepositories()
1212
'Caption' = 'Set Icinga Repository "Icinga Snapshot"';
1313
'Command' = 'Show-IcingaForWindowsManagementConsoleSetIcingaSnapshotRepositories';
1414
'Help' = 'Allows to set the repository URL for the "Icinga Snapshot" repository and will override it, if it already exist';
15+
},
16+
@{
17+
'Caption' = 'Show Icinga Repository list';
18+
'Command' = 'Show-IcingaForWindowsManagementConsoleIcingaRepositoriesList';
19+
'Help' = 'Shows a list of all defined Icinga Repositories on this machine';
20+
},
21+
@{
22+
'Caption' = 'Move Icinga Repository to top';
23+
'Command' = 'Show-IcingaForWindowsManagementConsolePushIcingaRepository';
24+
'Help' = 'Allows you to move certain repositories on the system to the top of the list, which will then be applied first';
25+
},
26+
@{
27+
'Caption' = 'Move Icinga Repository to bottom';
28+
'Command' = 'Show-IcingaForWindowsManagementConsolePopIcingaRepository';
29+
'Help' = 'Allows you to move certain repositories on the system to the bottom of the list, which will then be applied last';
30+
},
31+
@{
32+
'Caption' = 'Enable Icinga Repository';
33+
'Command' = 'Show-IcingaForWindowsManagementConsoleEnableIcingaRepository';
34+
'Help' = 'Allows you to enable certain repositories on the system';
35+
},
36+
@{
37+
'Caption' = 'Disable Icinga Repository';
38+
'Command' = 'Show-IcingaForWindowsManagementConsoleDisableIcingaRepository';
39+
'Help' = 'Allows you to disable certain repositories on the system';
40+
},
41+
@{
42+
'Caption' = 'Remove Icinga Repository';
43+
'Command' = 'Show-IcingaForWindowsManagementConsoleRemoveIcingaRepository';
44+
'Help' = 'Allows you to remove certain repositories from the system';
1545
}
1646
);
1747
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function Show-IcingaForWindowsManagementConsolePopIcingaRepository()
2+
{
3+
[array]$Repositories = @();
4+
[array]$RepoList = Get-IcingaRepositories;
5+
[int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name;
6+
7+
foreach ($repo in $RepoList) {
8+
9+
$PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength;
10+
$PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath);
11+
12+
$Repositories += @{
13+
'Caption' = $PrintName;
14+
'Command' = 'Show-IcingaForWindowsManagementConsolePopIcingaRepository';
15+
'Help' = '';
16+
'Action' = @{
17+
'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog';
18+
'Arguments' = @{
19+
'-Caption' = ([string]::Format('Move Icinga Repository "{0}" to bottom', $repo.Name));
20+
'-Command' = 'Pop-IcingaRepository';
21+
'-CmdArguments' = @{
22+
'-Name' = $repo.Name;
23+
}
24+
}
25+
}
26+
}
27+
}
28+
29+
if ($Repositories.Count -ne 0) {
30+
Show-IcingaForWindowsInstallerMenu `
31+
-Header 'Select a repository to move it to the bottom of the list' `
32+
-Entries $Repositories;
33+
} else {
34+
Show-IcingaForWindowsInstallerMenu `
35+
-Header 'There are no local configured Icinga Repositories'
36+
}
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function Show-IcingaForWindowsManagementConsolePushIcingaRepository()
2+
{
3+
[array]$Repositories = @();
4+
[array]$RepoList = Get-IcingaRepositories;
5+
[int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name;
6+
7+
foreach ($repo in $RepoList) {
8+
9+
$PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength;
10+
$PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath);
11+
12+
$Repositories += @{
13+
'Caption' = $PrintName;
14+
'Command' = 'Show-IcingaForWindowsManagementConsolePushIcingaRepository';
15+
'Help' = '';
16+
'Action' = @{
17+
'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog';
18+
'Arguments' = @{
19+
'-Caption' = ([string]::Format('Move Icinga Repository "{0}" to top', $repo.Name));
20+
'-Command' = 'Push-IcingaRepository';
21+
'-CmdArguments' = @{
22+
'-Name' = $repo.Name;
23+
}
24+
}
25+
}
26+
}
27+
}
28+
29+
if ($Repositories.Count -ne 0) {
30+
Show-IcingaForWindowsInstallerMenu `
31+
-Header 'Select a repository to move it to the top of the list' `
32+
-Entries $Repositories;
33+
} else {
34+
Show-IcingaForWindowsInstallerMenu `
35+
-Header 'There are no local configured Icinga Repositories'
36+
}
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function Show-IcingaForWindowsManagementConsoleRemoveIcingaRepository()
2+
{
3+
[array]$Repositories = @();
4+
[array]$RepoList = Get-IcingaRepositories;
5+
[int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name;
6+
7+
foreach ($repo in $RepoList) {
8+
9+
$PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength;
10+
$PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath);
11+
12+
$Repositories += @{
13+
'Caption' = $PrintName;
14+
'Command' = 'Show-IcingaForWindowsManagementConsoleRemoveIcingaRepository';
15+
'Help' = '';
16+
'Action' = @{
17+
'Command' = 'Show-IcingaWindowsManagementConsoleYesNoDialog';
18+
'Arguments' = @{
19+
'-Caption' = ([string]::Format('Remove Icinga Repository "{0}"', $repo.Name));
20+
'-Command' = 'Remove-IcingaRepository';
21+
'-CmdArguments' = @{
22+
'-Name' = $repo.Name;
23+
}
24+
}
25+
}
26+
}
27+
}
28+
29+
if ($Repositories.Count -ne 0) {
30+
Show-IcingaForWindowsInstallerMenu `
31+
-Header 'Select a repository to remove it from the system' `
32+
-Entries $Repositories;
33+
} else {
34+
Show-IcingaForWindowsInstallerMenu `
35+
-Header 'There are no local configured Icinga Repositories'
36+
}
37+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
function Show-IcingaForWindowsManagementConsoleIcingaRepositoriesList()
2+
{
3+
[array]$Repositories = @();
4+
[array]$RepoList = Get-IcingaRepositories;
5+
[int]$MaxLength = Get-IcingaMaxTextLength -TextArray $RepoList.Name;
6+
7+
foreach ($repo in $RepoList) {
8+
9+
$PrintName = Add-IcingaWhiteSpaceToString -Text $repo.Name -Length $MaxLength;
10+
$PrintName = [string]::Format('{0}=> {1}', $PrintName, $repo.Value.RemotePath);
11+
12+
$Repositories += @{
13+
'Caption' = $PrintName;
14+
'Command' = 'Show-IcingaForWindowsManagementConsoleIcingaRepositoriesList';
15+
'Help' = '';
16+
'Disabled' = (-Not $repo.Value.Enabled);
17+
}
18+
}
19+
20+
if ($Repositories.Count -ne 0) {
21+
Show-IcingaForWindowsInstallerMenu `
22+
-Header 'List of local configured Icinga Repositories' `
23+
-Entries $Repositories;
24+
} else {
25+
Show-IcingaForWindowsInstallerMenu `
26+
-Header 'There are no local configured Icinga Repositories'
27+
}
28+
}

lib/core/installer/menu/manage/general/RemoveComponents.psm1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
function Show-IcingaForWindowsMenuRemoveComponents()
22
{
3-
43
[array]$UninstallFeatures = @();
54
$AgentInstalled = (Get-IcingaAgentInstallation).Installed;
65
$PowerShellServiceInstalled = Get-Service -Name 'icingapowershell' -ErrorAction SilentlyContinue;

0 commit comments

Comments
 (0)