Skip to content

Commit

Permalink
added missing option to fleet server intructions (#121180)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic authored Dec 14, 2021
1 parent 8c7ed78 commit 303a82f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ describe('getInstallCommandForPlatform', () => {
expect(res).toMatchInlineSnapshot(`
"sudo ./elastic-agent install \\\\
--fleet-server-es=http://elasticsearch:9200 \\\\
--fleet-server-service-token=service-token-1"
--fleet-server-service-token=service-token-1 \\\\
--fleet-server-insecure-http"
`);
});

Expand All @@ -33,7 +34,8 @@ describe('getInstallCommandForPlatform', () => {
expect(res).toMatchInlineSnapshot(`
".\\\\elastic-agent.exe install \`
--fleet-server-es=http://elasticsearch:9200 \`
--fleet-server-service-token=service-token-1"
--fleet-server-service-token=service-token-1 \`
--fleet-server-insecure-http"
`);
});

Expand All @@ -47,7 +49,8 @@ describe('getInstallCommandForPlatform', () => {
expect(res).toMatchInlineSnapshot(`
"sudo elastic-agent enroll \\\\
--fleet-server-es=http://elasticsearch:9200 \\\\
--fleet-server-service-token=service-token-1"
--fleet-server-service-token=service-token-1 \\\\
--fleet-server-insecure-http"
`);
});

Expand All @@ -66,7 +69,8 @@ describe('getInstallCommandForPlatform', () => {
"sudo ./elastic-agent install \\\\
--fleet-server-es=http://elasticsearch:9200 \\\\
--fleet-server-service-token=service-token-1 \\\\
--fleet-server-es-ca-trusted-fingerprint=fingerprint123456"
--fleet-server-es-ca-trusted-fingerprint=fingerprint123456 \\\\
--fleet-server-insecure-http"
`);
});
});
Expand All @@ -84,7 +88,8 @@ describe('getInstallCommandForPlatform', () => {
"sudo ./elastic-agent install \\\\
--fleet-server-es=http://elasticsearch:9200 \\\\
--fleet-server-service-token=service-token-1 \\\\
--fleet-server-policy=policy-1"
--fleet-server-policy=policy-1 \\\\
--fleet-server-insecure-http"
`);
});

Expand All @@ -100,7 +105,8 @@ describe('getInstallCommandForPlatform', () => {
".\\\\elastic-agent.exe install \`
--fleet-server-es=http://elasticsearch:9200 \`
--fleet-server-service-token=service-token-1 \`
--fleet-server-policy=policy-1"
--fleet-server-policy=policy-1 \`
--fleet-server-insecure-http"
`);
});

Expand All @@ -116,7 +122,8 @@ describe('getInstallCommandForPlatform', () => {
"sudo elastic-agent enroll \\\\
--fleet-server-es=http://elasticsearch:9200 \\\\
--fleet-server-service-token=service-token-1 \\\\
--fleet-server-policy=policy-1"
--fleet-server-policy=policy-1 \\\\
--fleet-server-insecure-http"
`);
});
});
Expand Down Expand Up @@ -199,7 +206,8 @@ describe('getInstallCommandForPlatform', () => {
expect(res).toMatchInlineSnapshot(`
"sudo elastic-agent enroll \\\\
--fleet-server-es=http://elasticsearch:9200 \\\\
--fleet-server-service-token=service-token-1"
--fleet-server-service-token=service-token-1 \\\\
--fleet-server-insecure-http"
`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ export function getInstallCommandForPlatform(
}
commandArguments.push(['fleet-server-cert', '<PATH_TO_FLEET_SERVER_CERT>']);
commandArguments.push(['fleet-server-cert-key', '<PATH_TO_FLEET_SERVER_CERT_KEY>']);
} else {
commandArguments.push(['fleet-server-insecure-http']);
}

const commandArgumentsStr = commandArguments.reduce((acc, [key, val]) => {
if (acc === '' && key === 'url') {
return `--${key}=${val}`;
}
return (acc += ` ${newLineSeparator} --${key}=${val}`);
const valOrEmpty = val ? `=${val}` : '';
return (acc += ` ${newLineSeparator} --${key}${valOrEmpty}`);
}, '');

switch (platform) {
Expand Down

0 comments on commit 303a82f

Please sign in to comment.