mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Improves and standardizes the wizard even further
This commit is contained in:
parent
6e50603b30
commit
6838933bd5
7 changed files with 20 additions and 24 deletions
|
|
@ -60,7 +60,7 @@ function Get-IcingaPowerShellModuleArchive()
|
|||
if ([string]::IsNullOrEmpty($DownloadUrl)) {
|
||||
if ($SkipRepo -Or (Get-IcingaAgentInstallerAnswerInput -Prompt ([string]::Format('Do you provide a custom repository for "{0}"?', $ModuleName)) -Default 'n').result -eq 1) {
|
||||
if ($Release -eq $FALSE -And $Snapshot -eq $FALSE) {
|
||||
$branch = (Get-IcingaAgentInstallerAnswerInput -Prompt 'Which version do you want to install? (release/snapshot)' -Default 'v' -DefaultInput 'release').answer;
|
||||
$branch = (Get-IcingaAgentInstallerAnswerInput -Prompt ([string]::Format('Which version of the "{0}" do you want to install? (release/snapshot)', $ModuleName)) -Default 'v' -DefaultInput 'release').answer;
|
||||
} elseif ($Release) {
|
||||
$branch = 'release';
|
||||
} else {
|
||||
|
|
@ -74,7 +74,7 @@ function Get-IcingaPowerShellModuleArchive()
|
|||
$DownloadUrl = $LatestRelease.Replace('/releases/tag/', '/archive/');
|
||||
$Tag = $DownloadUrl.Split('/')[-1];
|
||||
} catch {
|
||||
Write-Host 'Failed to fetch latest release from GitHub. Either the module or the GitHub account do not exist';
|
||||
Write-IcingaConsoleError -Message 'Failed to fetch latest release for "{0}" from GitHub. Either the module or the GitHub account do not exist' -Objects $ModuleName;
|
||||
}
|
||||
|
||||
$DownloadUrl = [string]::Format('{0}/{1}.zip', $DownloadUrl, $Tag);
|
||||
|
|
@ -94,7 +94,7 @@ function Get-IcingaPowerShellModuleArchive()
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$DownloadUrl = (Get-IcingaAgentInstallerAnswerInput -Prompt ([string]::Format('Please enter the full Url to your "{0}" Zip-Archive', $ModuleName)) -Default 'v').answer;
|
||||
$DownloadUrl = (Get-IcingaAgentInstallerAnswerInput -Prompt ([string]::Format('Please enter the full path of the custom repository for the "{0}" (location of zip file)', $ModuleName)) -Default 'v').answer;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ function Install-IcingaFrameworkComponent()
|
|||
-GitHubUser $GitHubUser `
|
||||
-ModuleName (
|
||||
[string]::Format(
|
||||
'Icinga Component {0}', $ComponentName
|
||||
'Icinga {0}', $ComponentName
|
||||
)
|
||||
) `
|
||||
-Repository $RepositoryName `
|
||||
|
|
@ -73,7 +73,7 @@ function Install-IcingaFrameworkComponent()
|
|||
};
|
||||
}
|
||||
|
||||
Write-Host ([string]::Format('Installing module into "{0}"', ($Archive.Directory)));
|
||||
Write-IcingaConsoleNotice ([string]::Format('Installing module into "{0}"', ($Archive.Directory)));
|
||||
Expand-IcingaZipArchive -Path $Archive.Archive -Destination $Archive.Directory | Out-Null;
|
||||
|
||||
$FolderContent = Get-ChildItem -Path $Archive.Directory;
|
||||
|
|
@ -86,19 +86,19 @@ function Install-IcingaFrameworkComponent()
|
|||
}
|
||||
}
|
||||
|
||||
Write-Host ([string]::Format('Using content of folder "{0}" for updates', $ModuleContent));
|
||||
Write-IcingaConsoleNotice ([string]::Format('Using content of folder "{0}" for updates', $ModuleContent));
|
||||
|
||||
$PluginDirectory = (Join-Path -Path $Archive.ModuleRoot -ChildPath $RepositoryName);
|
||||
|
||||
if ((Test-Path $PluginDirectory) -eq $FALSE) {
|
||||
Write-Host ([string]::Format('{0} Module Directory "{1}" is not present. Creating Directory', $ComponentName, $PluginDirectory));
|
||||
Write-IcingaConsoleNotice ([string]::Format('{0} Module Directory "{1}" is not present. Creating Directory', $ComponentName, $PluginDirectory));
|
||||
New-Item -Path $PluginDirectory -ItemType Directory | Out-Null;
|
||||
}
|
||||
|
||||
Write-Host ([string]::Format('Copying files to {0}', $ComponentName));
|
||||
Write-IcingaConsoleNotice ([string]::Format('Copying files to {0}', $ComponentName));
|
||||
Copy-ItemSecure -Path (Join-Path -Path $ModuleContent -ChildPath '/*') -Destination $PluginDirectory -Recurse -Force | Out-Null;
|
||||
|
||||
Write-Host 'Cleaning temporary content';
|
||||
Write-IcingaConsoleNotice 'Cleaning temporary content';
|
||||
Start-Sleep -Seconds 1;
|
||||
Remove-ItemSecure -Path $Archive.Directory -Recurse -Force | Out-Null;
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ function Install-IcingaFrameworkComponent()
|
|||
# Now import the module
|
||||
Import-Module $RepositoryName;
|
||||
|
||||
Write-Host ([string]::Format('Icinga component {0} update has been completed. Please start a new PowerShell to apply it', $ComponentName));
|
||||
Write-IcingaConsoleNotice ([string]::Format('Icinga {0} update has been completed. Please start a new PowerShell to apply it', $ComponentName));
|
||||
|
||||
return @{
|
||||
'RepoUrl' = $Archive.DownloadUrl
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ function Start-IcingaAgentDirectorWizard()
|
|||
|
||||
[hashtable]$DirectorOverrideArgs = @{}
|
||||
if ([string]::IsNullOrEmpty($DirectorUrl)) {
|
||||
$DirectorUrl = (Get-IcingaAgentInstallerAnswerInput -Prompt 'Please specify the Url pointing to your Icinga Director' -Default 'v').answer;
|
||||
$DirectorUrl = (Get-IcingaAgentInstallerAnswerInput -Prompt 'Please specify the Url pointing to your Icinga Director (Example: "https://example.com/icingaweb2/director")' -Default 'v').answer;
|
||||
}
|
||||
|
||||
[bool]$HostKnown = $FALSE;
|
||||
|
|
|
|||
|
|
@ -252,13 +252,13 @@ function Start-IcingaAgentInstallWizard()
|
|||
}
|
||||
|
||||
if ($Endpoints.Count -eq 0) {
|
||||
$ArrayString = (Get-IcingaAgentInstallerAnswerInput -Prompt 'Please specify the parent node(s) separated by "," (Example: "master-icinga2a, master-icinga2b")' -Default 'v').answer;
|
||||
$ArrayString = (Get-IcingaAgentInstallerAnswerInput -Prompt 'Please specify the parent node(s) separated by "," (Examples: "master1, master2" or "master1.example.com, master2.example.com")' -Default 'v').answer;
|
||||
$Endpoints = ($ArrayString.Replace(' ', '')).Split(',');
|
||||
$InstallerArguments += ("-Endpoints " + ([string]::Join(',', $Endpoints)));
|
||||
}
|
||||
|
||||
if ($null -eq $CAPort) {
|
||||
if ((Get-IcingaAgentInstallerAnswerInput -Prompt 'Are you using a custom port for Icinga communication?' -Default 'n').result -eq 0) {
|
||||
if ((Get-IcingaAgentInstallerAnswerInput -Prompt 'Are you using another port than 5665 for Icinga communication?' -Default 'n').result -eq 0) {
|
||||
$CAPort = (Get-IcingaAgentInstallerAnswerInput -Prompt 'Please enter the port for Icinga communication' -Default 'v' -DefaultInput '5665').answer;
|
||||
$InstallerArguments += "-CAPort $CAPort";
|
||||
} else {
|
||||
|
|
@ -473,7 +473,7 @@ function Start-IcingaAgentInstallWizard()
|
|||
}
|
||||
|
||||
if ($null -eq $InstallFrameworkPlugins) {
|
||||
if ((Get-IcingaAgentInstallerAnswerInput -Prompt 'Do you want to install the Icinga Plugins?' -Default 'y').result -eq 1) {
|
||||
if ((Get-IcingaAgentInstallerAnswerInput -Prompt 'Do you want to install the Icinga PowerShell Plugins?' -Default 'y').result -eq 1) {
|
||||
$result = Install-IcingaFrameworkPlugins -PluginsUrl $PluginsUrl;
|
||||
$PluginsUrl = $result.PluginUrl;
|
||||
$InstallerArguments += "-InstallFrameworkPlugins 1";
|
||||
|
|
@ -492,7 +492,7 @@ function Start-IcingaAgentInstallWizard()
|
|||
}
|
||||
|
||||
if ($null -eq $InstallFrameworkService) {
|
||||
if ((Get-IcingaAgentInstallerAnswerInput -Prompt 'Do you want to install the PowerShell Framework as a service?' -Default 'y').result -eq 1) {
|
||||
if ((Get-IcingaAgentInstallerAnswerInput -Prompt 'Do you want to install the Icinga PowerShell Framework as a service?' -Default 'y').result -eq 1) {
|
||||
$result = Get-IcingaFrameworkServiceBinary;
|
||||
$InstallerArguments += "-InstallFrameworkService 1";
|
||||
$InstallerArguments += [string]::Format("-FrameworkServiceUrl '{0}'", $result.FrameworkServiceUrl);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ function New-IcingaBasicAuthHeader()
|
|||
);
|
||||
|
||||
if ($null -eq $Password -or [string]::IsNullOrEmpty($Username)) {
|
||||
Write-Host 'Please specify your Username and Password to continue';
|
||||
Write-IcingaConsoleWarning 'Please specify your username and password to continue';
|
||||
return @{};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ function Disable-IcingaUntrustedCertificateValidation()
|
|||
try {
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = $null;
|
||||
|
||||
Write-Host 'Successfully disabled untrusted certificate validation for this shell instance';
|
||||
Write-IcingaConsoleNotice 'Successfully disabled untrusted certificate validation for this shell instance';
|
||||
} catch {
|
||||
Write-Host (
|
||||
Write-IcingaConsoleError (
|
||||
[string]::Format(
|
||||
'Failed to disable untrusted certificate policy: {0}', $_.Exception.Message
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,12 +16,8 @@ function Enable-IcingaUntrustedCertificateValidation()
|
|||
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object IcingaUntrustedCertificateValidation;
|
||||
|
||||
Write-Host 'Successfully enabled untrusted certificate validation for this shell instance';
|
||||
Write-IcingaConsoleNotice 'Successfully enabled untrusted certificate validation for this shell instance';
|
||||
} catch {
|
||||
Write-Host (
|
||||
[string]::Format(
|
||||
'Failed to enable untrusted certificate policy: {0}', $_.Exception.Message
|
||||
)
|
||||
);
|
||||
Write-IcingaConsoleError -Message 'Failed to enable untrusted certificate policy: {0}' -Objects $_.Exception.Message;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue