Skip to content

Commit 0c4121d

Browse files
committed
Fixex multiple endpoint handling and IP conversion with Director Self Service
Fixes #70
1 parent f667856 commit 0c4121d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/core/icingaagent/misc/Convert-IcingaDirectorSelfServiceArguments.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ function Convert-IcingaDirectorSelfServiceArguments()
5959
$NetworkDefault += [string]::Format('[{0}]:{1},', $Endpoint, $JsonInput.agent_listen_port);
6060
}
6161
if ([string]::IsNullOrEmpty($NetworkDefault) -eq $FALSE) {
62-
$NetworkDefault = $NetworkDefault.Substring(0, $NetworkDefault.Length - 1);
62+
$NetworkDefault = $NetworkDefault.Substring(0, $NetworkDefault.Length - 1).Split(',');
6363
$DirectorArguments.Add(
6464
'EndpointConnections', $NetworkDefault
6565
);
6666

67-
$EndpointConnections = $NetworkDefault.Split(',');
67+
$EndpointConnections = $NetworkDefault;
6868
$DirectorArguments.Add(
6969
'CAEndpoint', (Get-IPConfigFromString $EndpointConnections[0]).address
7070
);

lib/core/icingaagent/misc/Start-IcingaAgentInstallWizard.psm1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ function Start-IcingaAgentInstallWizard()
310310
if ($EndpointConnections.Count -eq 0) {
311311
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $Endpoints.Split(',');
312312
} else {
313-
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $EndpointConnections.Split(',');
313+
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $EndpointConnections;
314314
}
315315
if ($EndpointsConversion.HasErrors) {
316316
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()
340340
}
341341
}
342342
$InstallerArguments += ("-EndpointConnections " + ([string]::Join(',', $EndpointConnections)));
343+
} elseif ($EndpointConnections.Count -ne 0 -And $AcceptConnections -eq 0 -And $ConvertEndpointIPConfig) {
344+
$EndpointsConversion = Convert-IcingaEndpointsToIPv4 -NetworkConfig $EndpointConnections;
345+
if ($EndpointsConversion.HasErrors) {
346+
Write-IcingaConsoleWarning -Message 'Not all of your endpoint connection data could be resolved. These endpoints were dropped: {0}' -Objects ([string]::Join(', ', $EndpointsConversion.Unresolved));
347+
}
348+
$EndpointConnections = $EndpointsConversion.Network;
343349
}
344350

345351
if ([string]::IsNullOrEmpty($ParentZone)) {

0 commit comments

Comments
 (0)