mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Adds repo management to mmc
This commit is contained in:
parent
646bc7f5be
commit
7861ebf565
6 changed files with 123 additions and 4 deletions
|
|
@ -18,6 +18,11 @@ function Show-IcingaForWindowsManagementConsoleManageFramework()
|
||||||
'Help' = 'Allows you to manage Icinga for Windows background daemons';
|
'Help' = 'Allows you to manage Icinga for Windows background daemons';
|
||||||
'Disabled' = ($null -eq (Get-Service 'icingapowershell' -ErrorAction SilentlyContinue));
|
'Disabled' = ($null -eq (Get-Service 'icingapowershell' -ErrorAction SilentlyContinue));
|
||||||
},
|
},
|
||||||
|
@{
|
||||||
|
'Caption' = 'Manage Icinga Repositories';
|
||||||
|
'Command' = 'Show-IcingaForWindowsManagementConsoleManageIcingaRepositories';
|
||||||
|
'Help' = 'Allows you to manage Icinga for Windows repositories';
|
||||||
|
},
|
||||||
@{
|
@{
|
||||||
'Caption' = ([string]::Format('Framework Debug Mode: {0}', (& { if ($FrameworkDebug) { 'Enabled' } else { 'Disabled' } } )));
|
'Caption' = ([string]::Format('Framework Debug Mode: {0}', (& { if ($FrameworkDebug) { 'Enabled' } else { 'Disabled' } } )));
|
||||||
'Command' = 'Show-IcingaForWindowsManagementConsoleManageFramework';
|
'Command' = 'Show-IcingaForWindowsManagementConsoleManageFramework';
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
function Show-IcingaForWindowsManagementConsoleManageIcingaRepositories()
|
||||||
|
{
|
||||||
|
Show-IcingaForWindowsInstallerMenu `
|
||||||
|
-Header 'Manage Icinga for Windows Repositories:' `
|
||||||
|
-Entries @(
|
||||||
|
@{
|
||||||
|
'Caption' = 'Set Icinga Repository "Icinga Stable"';
|
||||||
|
'Command' = 'Show-IcingaForWindowsManagementConsoleSetIcingaStableRepositories';
|
||||||
|
'Help' = 'Allows to set the repository URL for the "Icinga Stable" repository and will override it, if it already exist';
|
||||||
|
},
|
||||||
|
@{
|
||||||
|
'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';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
function Show-IcingaForWindowsManagementConsoleSetIcingaSnapshotRepositories()
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
[array]$Value = @( 'https://packages.icinga.com/IcingaForWindows/snapshot/ifw.repo.json' ),
|
||||||
|
[string]$DefaultInput = 'c',
|
||||||
|
[switch]$JumpToSummary = $FALSE,
|
||||||
|
[switch]$Automated = $FALSE,
|
||||||
|
[switch]$Advanced = $FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
$CurrentRepositories = Get-IcingaRepositories;
|
||||||
|
|
||||||
|
foreach ($entry in $CurrentRepositories) {
|
||||||
|
if ($entry.Name -eq 'Icinga Snapshot') {
|
||||||
|
$Value = $entry.Value.RemotePath;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Show-IcingaForWindowsInstallerMenu `
|
||||||
|
-Header 'Please enter the URL/Path for the location of your "Icinga Snapshot" Repository:' `
|
||||||
|
-Entries @(
|
||||||
|
@{
|
||||||
|
'Command' = 'Show-IcingaForWindowsManagementConsoleManageIcingaRepositories';
|
||||||
|
'Help' = 'Sets the current repository for Icinga for Windows as "Icinga Snapshot"';
|
||||||
|
}
|
||||||
|
) `
|
||||||
|
-DefaultIndex $DefaultInput `
|
||||||
|
-AddConfig `
|
||||||
|
-ConfigLimit 1 `
|
||||||
|
-DefaultValues $Value `
|
||||||
|
-ContinueFirstValue `
|
||||||
|
-MandatoryValue `
|
||||||
|
-ConfigElement `
|
||||||
|
-HiddenConfigElement `
|
||||||
|
-Advanced `
|
||||||
|
-NoConfigSwap;
|
||||||
|
|
||||||
|
if (Test-IcingaForWindowsManagementConsoleContinue) {
|
||||||
|
$UserInput = Get-IcingaForWindowsInstallerValuesFromStep -InstallerStep 'Show-IcingaForWindowsManagementConsoleSetIcingaSnapshotRepositories';
|
||||||
|
|
||||||
|
Add-IcingaRepository -Name 'Icinga Snapshot' -RemotePath $UserInput -Force;
|
||||||
|
|
||||||
|
$global:Icinga.InstallWizard.LastNotice = ([string]::Format('Updated repository "Icinga Snapshot" with URL "{0}"', $UserInput));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
function Show-IcingaForWindowsManagementConsoleSetIcingaStableRepositories()
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
[array]$Value = @( 'https://packages.icinga.com/IcingaForWindows/stable/ifw.repo.json' ),
|
||||||
|
[string]$DefaultInput = 'c',
|
||||||
|
[switch]$JumpToSummary = $FALSE,
|
||||||
|
[switch]$Automated = $FALSE,
|
||||||
|
[switch]$Advanced = $FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
$CurrentRepositories = Get-IcingaRepositories;
|
||||||
|
|
||||||
|
foreach ($entry in $CurrentRepositories) {
|
||||||
|
if ($entry.Name -eq 'Icinga Stable') {
|
||||||
|
$Value = $entry.Value.RemotePath;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Show-IcingaForWindowsInstallerMenu `
|
||||||
|
-Header 'Please enter the URL/Path for the location of your "Icinga Stable" Repository:' `
|
||||||
|
-Entries @(
|
||||||
|
@{
|
||||||
|
'Command' = 'Show-IcingaForWindowsManagementConsoleManageIcingaRepositories';
|
||||||
|
'Help' = 'Sets the current repository for Icinga for Windows as "Icinga Stable"';
|
||||||
|
}
|
||||||
|
) `
|
||||||
|
-DefaultIndex $DefaultInput `
|
||||||
|
-AddConfig `
|
||||||
|
-ConfigLimit 1 `
|
||||||
|
-DefaultValues $Value `
|
||||||
|
-ContinueFirstValue `
|
||||||
|
-MandatoryValue `
|
||||||
|
-ConfigElement `
|
||||||
|
-HiddenConfigElement `
|
||||||
|
-Advanced `
|
||||||
|
-NoConfigSwap;
|
||||||
|
|
||||||
|
if (Test-IcingaForWindowsManagementConsoleContinue) {
|
||||||
|
$UserInput = Get-IcingaForWindowsInstallerValuesFromStep -InstallerStep 'Show-IcingaForWindowsManagementConsoleSetIcingaStableRepositories';
|
||||||
|
|
||||||
|
Add-IcingaRepository -Name 'Icinga Stable' -RemotePath $UserInput -Force;
|
||||||
|
|
||||||
|
$global:Icinga.InstallWizard.LastNotice = ([string]::Format('Updated repository "Icinga Stable" with URL "{0}"', $UserInput));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,8 @@ function Add-IcingaForWindowsInstallerConfigEntry()
|
||||||
[switch]$OverwriteValues = $FALSE,
|
[switch]$OverwriteValues = $FALSE,
|
||||||
[string]$OverwriteMenu = '',
|
[string]$OverwriteMenu = '',
|
||||||
[string]$OverwriteParent = '',
|
[string]$OverwriteParent = '',
|
||||||
[switch]$Advanced = $FALSE
|
[switch]$Advanced = $FALSE,
|
||||||
|
[switch]$NoConfigSwap = $FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($OverwriteMenu) -eq $FALSE) {
|
if ([string]::IsNullOrEmpty($OverwriteMenu) -eq $FALSE) {
|
||||||
|
|
@ -55,5 +56,7 @@ function Add-IcingaForWindowsInstallerConfigEntry()
|
||||||
$global:Icinga.InstallWizard.Config[$Step].Modified = $TRUE;
|
$global:Icinga.InstallWizard.Config[$Step].Modified = $TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($NoConfigSwap -eq $FALSE) {
|
||||||
Write-IcingaforWindowsManagementConsoleConfigSwap -Config $global:Icinga.InstallWizard.Config;
|
Write-IcingaforWindowsManagementConsoleConfigSwap -Config $global:Icinga.InstallWizard.Config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ function Show-IcingaForWindowsInstallerMenu()
|
||||||
[switch]$ReadOnly = $FALSE,
|
[switch]$ReadOnly = $FALSE,
|
||||||
[switch]$Automated = $FALSE,
|
[switch]$Automated = $FALSE,
|
||||||
[switch]$Advanced = $FALSE,
|
[switch]$Advanced = $FALSE,
|
||||||
[switch]$PlainTextOutput = $FALSE
|
[switch]$PlainTextOutput = $FALSE,
|
||||||
|
[switch]$NoConfigSwap = $FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((Test-IcingaForWindowsInstallationHeaderPrint) -eq $FALSE -And (Get-IcingaFrameworkDebugMode) -eq $FALSE) {
|
if ((Test-IcingaForWindowsInstallationHeaderPrint) -eq $FALSE -And (Get-IcingaFrameworkDebugMode) -eq $FALSE) {
|
||||||
|
|
@ -413,7 +414,8 @@ function Show-IcingaForWindowsInstallerMenu()
|
||||||
-Values $StoredValues `
|
-Values $StoredValues `
|
||||||
-Hidden:$HiddenConfigElement `
|
-Hidden:$HiddenConfigElement `
|
||||||
-PasswordInput:$PasswordInput `
|
-PasswordInput:$PasswordInput `
|
||||||
-Advanced:$Advanced;
|
-Advanced:$Advanced `
|
||||||
|
-NoConfigSwap:$NoConfigSwap;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Reset Help View
|
# Reset Help View
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue