mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Fleet] Fix logstash output preconfiguration and fleet server instructions (#137474)
This commit is contained in:
parent
c35e8d6a65
commit
9a76a55ff3
3 changed files with 30 additions and 4 deletions
|
@ -62,16 +62,18 @@ const InstallFleetServerStepContent: React.FunctionComponent<{
|
|||
const kibanaVersion = useKibanaVersion();
|
||||
const { output } = useDefaultOutput();
|
||||
|
||||
const commandOutput = output?.type === 'elasticsearch' ? output : undefined;
|
||||
|
||||
const installCommands = (['linux', 'mac', 'windows', 'deb', 'rpm'] as PLATFORM_TYPE[]).reduce(
|
||||
(acc, platform) => {
|
||||
acc[platform] = getInstallCommandForPlatform(
|
||||
platform,
|
||||
output?.hosts?.[0] ?? '',
|
||||
commandOutput?.hosts?.[0] ?? '<ELASTICSEARCH_HOST>',
|
||||
serviceToken ?? '',
|
||||
fleetServerPolicyId,
|
||||
fleetServerHost,
|
||||
deploymentMode === 'production',
|
||||
output?.ca_trusted_fingerprint,
|
||||
commandOutput?.ca_trusted_fingerprint,
|
||||
kibanaVersion
|
||||
);
|
||||
|
||||
|
|
|
@ -112,6 +112,26 @@ describe('output preconfiguration', () => {
|
|||
expect(spyAgentPolicyServicBumpAllAgentPoliciesForOutput).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('should create preconfigured logstash output that does not exist', async () => {
|
||||
const soClient = savedObjectsClientMock.create();
|
||||
const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser;
|
||||
await createOrUpdatePreconfiguredOutputs(soClient, esClient, [
|
||||
{
|
||||
id: 'non-existing-output-1',
|
||||
name: 'Output 1',
|
||||
type: 'logstash',
|
||||
is_default: false,
|
||||
is_default_monitoring: false,
|
||||
hosts: ['test.fr'],
|
||||
ssl: { certificate: 'test', key: 'test' },
|
||||
},
|
||||
]);
|
||||
|
||||
expect(mockedOutputService.create).toBeCalled();
|
||||
expect(mockedOutputService.update).not.toBeCalled();
|
||||
expect(spyAgentPolicyServicBumpAllAgentPoliciesForOutput).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('should set default hosts if hosts is not set output that does not exists', async () => {
|
||||
const soClient = savedObjectsClientMock.create();
|
||||
const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser;
|
||||
|
|
|
@ -159,8 +159,12 @@ function isPreconfiguredOutputDifferentFromCurrent(
|
|||
existingOutput.type !== preconfiguredOutput.type ||
|
||||
(preconfiguredOutput.hosts &&
|
||||
!isEqual(
|
||||
existingOutput.hosts?.map(normalizeHostsForAgents),
|
||||
preconfiguredOutput.hosts.map(normalizeHostsForAgents)
|
||||
existingOutput?.type === 'elasticsearch'
|
||||
? existingOutput.hosts?.map(normalizeHostsForAgents)
|
||||
: existingOutput.hosts,
|
||||
preconfiguredOutput.type === 'elasticsearch'
|
||||
? preconfiguredOutput.hosts.map(normalizeHostsForAgents)
|
||||
: preconfiguredOutput.hosts
|
||||
)) ||
|
||||
(preconfiguredOutput.ssl && !isEqual(preconfiguredOutput.ssl, existingOutput.ssl)) ||
|
||||
existingOutput.ca_sha256 !== preconfiguredOutput.ca_sha256 ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue