mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes FQDN to IP wizard conversion question
This commit is contained in:
parent
7961a0d0d1
commit
2ac3de5267
2 changed files with 17 additions and 10 deletions
|
|
@ -285,11 +285,15 @@ function Start-IcingaAgentInstallWizard()
|
||||||
if ((Get-IcingaAgentInstallerAnswerInput -Prompt ([string]::Format('Do you want to convert all possible provided FQDN address for endpoint/network configuration for Icinga 2 to plain IP-Address?', $CAPort)) -Default 'y').result -eq 1) {
|
if ((Get-IcingaAgentInstallerAnswerInput -Prompt ([string]::Format('Do you want to convert all possible provided FQDN address for endpoint/network configuration for Icinga 2 to plain IP-Address?', $CAPort)) -Default 'y').result -eq 1) {
|
||||||
$InstallerArguments += "-ConvertEndpointIPConfig 1";
|
$InstallerArguments += "-ConvertEndpointIPConfig 1";
|
||||||
$ConvertEndpointIPConfig = $TRUE;
|
$ConvertEndpointIPConfig = $TRUE;
|
||||||
|
if ($EndpointConnections.Count -eq 0) {
|
||||||
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $Endpoints;
|
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $Endpoints;
|
||||||
if ($EndpointsConversion.HasErrors) {
|
} else {
|
||||||
Write-Host 'Not all of your endpoints configuration could be converted and was therefor dropped';
|
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $EndpointConnections;
|
||||||
}
|
}
|
||||||
$Endpoints = $EndpointsConversion.Network;
|
if ($EndpointsConversion.HasErrors) {
|
||||||
|
Write-Host ([string]::Format('Not all of your endpoint configuration could be resolved and is not reachable by this host. These endpoints were dropped: {0}', ([string]::Join(', ', $EndpointsConversion.Unresolved))));
|
||||||
|
}
|
||||||
|
$EndpointConnections = $EndpointsConversion.Network;
|
||||||
} else {
|
} else {
|
||||||
$InstallerArguments += "-ConvertEndpointIPConfig 0";
|
$InstallerArguments += "-ConvertEndpointIPConfig 0";
|
||||||
$ConvertEndpointIPConfig = $FALSE;
|
$ConvertEndpointIPConfig = $FALSE;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ function Convert-IcingaEndpointsToIPv4()
|
||||||
);
|
);
|
||||||
|
|
||||||
[array]$ResolvedNetwork = @();
|
[array]$ResolvedNetwork = @();
|
||||||
|
[array]$UnresolvedNetwork = @();
|
||||||
[bool]$HasUnresolved = $FALSE;
|
[bool]$HasUnresolved = $FALSE;
|
||||||
[string]$Domain = $ENV:UserDNSDomain;
|
[string]$Domain = $ENV:UserDNSDomain;
|
||||||
|
|
||||||
|
|
@ -48,6 +49,7 @@ function Convert-IcingaEndpointsToIPv4()
|
||||||
);
|
);
|
||||||
$ResolvedNetwork += $entry.Replace($Network.address, $ResolvedIP);
|
$ResolvedNetwork += $entry.Replace($Network.address, $ResolvedIP);
|
||||||
} catch {
|
} catch {
|
||||||
|
$UnresolvedNetwork += $entry;
|
||||||
$HasUnresolved = $TRUE;
|
$HasUnresolved = $TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -56,5 +58,6 @@ function Convert-IcingaEndpointsToIPv4()
|
||||||
return @{
|
return @{
|
||||||
'Network' = $ResolvedNetwork;
|
'Network' = $ResolvedNetwork;
|
||||||
'HasErrors' = $HasUnresolved;
|
'HasErrors' = $HasUnresolved;
|
||||||
|
'Unresolved' = $UnresolvedNetwork;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue