Fixex multiple endpoint handling and IP conversion with Director Self Service

Fixes #70
This commit is contained in:
Christian Stein 2020-06-18 10:14:01 +02:00
parent c2bd5e9aad
commit 06d5966a34
2 changed files with 9 additions and 3 deletions

View file

@ -59,12 +59,12 @@ function Convert-IcingaDirectorSelfServiceArguments()
$NetworkDefault += [string]::Format('[{0}]:{1},', $Endpoint, $JsonInput.agent_listen_port); $NetworkDefault += [string]::Format('[{0}]:{1},', $Endpoint, $JsonInput.agent_listen_port);
} }
if ([string]::IsNullOrEmpty($NetworkDefault) -eq $FALSE) { if ([string]::IsNullOrEmpty($NetworkDefault) -eq $FALSE) {
$NetworkDefault = $NetworkDefault.Substring(0, $NetworkDefault.Length - 1); $NetworkDefault = $NetworkDefault.Substring(0, $NetworkDefault.Length - 1).Split(',');
$DirectorArguments.Add( $DirectorArguments.Add(
'EndpointConnections', $NetworkDefault 'EndpointConnections', $NetworkDefault
); );
$EndpointConnections = $NetworkDefault.Split(','); $EndpointConnections = $NetworkDefault;
$DirectorArguments.Add( $DirectorArguments.Add(
'CAEndpoint', (Get-IPConfigFromString $EndpointConnections[0]).address 'CAEndpoint', (Get-IPConfigFromString $EndpointConnections[0]).address
); );

View file

@ -310,7 +310,7 @@ function Start-IcingaAgentInstallWizard()
if ($EndpointConnections.Count -eq 0) { if ($EndpointConnections.Count -eq 0) {
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $Endpoints.Split(','); $EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $Endpoints.Split(',');
} else { } else {
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $EndpointConnections.Split(','); $EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $EndpointConnections;
} }
if ($EndpointsConversion.HasErrors) { if ($EndpointsConversion.HasErrors) {
Write-IcingaConsoleWarning -Message 'Not all of your endpoint connection data could be resolved. These endpoints were dropped: {0}' -Objects ([string]::Join(', ', $EndpointsConversion.Unresolved)); Write-IcingaConsoleWarning -Message 'Not all of your endpoint connection data could be resolved. These endpoints were dropped: {0}' -Objects ([string]::Join(', ', $EndpointsConversion.Unresolved));
@ -340,6 +340,12 @@ function Start-IcingaAgentInstallWizard()
} }
} }
$InstallerArguments += ("-EndpointConnections " + ([string]::Join(',', $EndpointConnections))); $InstallerArguments += ("-EndpointConnections " + ([string]::Join(',', $EndpointConnections)));
} elseif ($EndpointConnections.Count -ne 0 -And $AcceptConnections -eq 0 -And $ConvertEndpointIPConfig) {
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $EndpointConnections;
if ($EndpointsConversion.HasErrors) {
Write-IcingaConsoleWarning -Message 'Not all of your endpoint connection data could be resolved. These endpoints were dropped: {0}' -Objects ([string]::Join(', ', $EndpointsConversion.Unresolved));
}
$EndpointConnections = $EndpointsConversion.Network;
} }
if ([string]::IsNullOrEmpty($ParentZone)) { if ([string]::IsNullOrEmpty($ParentZone)) {