Skip to content

Commit edd7bde

Browse files
committed
fetch kibana version
1 parent 56d2c99 commit edd7bde

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

x-pack/plugins/security_solution/common/endpoint/index_data.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,26 @@ const fleetEnrollAgentForHost = async (
316316
return;
317317
}
318318

319-
const kibanaVersion = await kbnClient.fetchKibanaVersion().number;
319+
const fetchKibanaVersion = async () => {
320+
const version = ((await kbnClient.request({
321+
path: '/api/status',
322+
method: 'GET',
323+
})) as AxiosResponse).data.version.number;
324+
if (!version) {
325+
// eslint-disable-next-line no-console
326+
console.log('failed to retrieve kibana version');
327+
}
328+
return version;
329+
};
330+
320331
// Enroll an agent for the Host
321332
const body: PostAgentEnrollRequest['body'] = {
322333
type: 'PERMANENT',
323334
metadata: {
324335
local: {
325336
elastic: {
326337
agent: {
327-
version: '8.0.0',
338+
version: await fetchKibanaVersion(),
328339
},
329340
},
330341
host: {

0 commit comments

Comments
 (0)