From e57f92549baa99ffd04a722b99906d49bc144734 Mon Sep 17 00:00:00 2001 From: Patrick Mueller Date: Fri, 5 Jun 2020 11:04:03 -0400 Subject: [PATCH] [Alerting] change eventLog ILM requests to absolute URLs (#68331) resolves https://github.com/elastic/kibana/issues/68265 This changes the ILM requests made by the eventLog from relative to absolute URLs. These requests test the existence of and create ILM policies, and are made with a cluster client using `transport.request`. Relative URLs work fine locally and in CI, however do not work on the cloud. --- .../event_log/server/es/cluster_client_adapter.test.ts | 4 ++-- x-pack/plugins/event_log/server/es/cluster_client_adapter.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/event_log/server/es/cluster_client_adapter.test.ts b/x-pack/plugins/event_log/server/es/cluster_client_adapter.test.ts index 0144e573fc1462..ada86adf84cfd2 100644 --- a/x-pack/plugins/event_log/server/es/cluster_client_adapter.test.ts +++ b/x-pack/plugins/event_log/server/es/cluster_client_adapter.test.ts @@ -51,7 +51,7 @@ describe('doesIlmPolicyExist', () => { await clusterClientAdapter.doesIlmPolicyExist('foo'); expect(clusterClient.callAsInternalUser).toHaveBeenCalledWith('transport.request', { method: 'GET', - path: '_ilm/policy/foo', + path: '/_ilm/policy/foo', }); }); @@ -78,7 +78,7 @@ describe('createIlmPolicy', () => { await clusterClientAdapter.createIlmPolicy('foo', { args: true }); expect(clusterClient.callAsInternalUser).toHaveBeenCalledWith('transport.request', { method: 'PUT', - path: '_ilm/policy/foo', + path: '/_ilm/policy/foo', body: { args: true }, }); }); diff --git a/x-pack/plugins/event_log/server/es/cluster_client_adapter.ts b/x-pack/plugins/event_log/server/es/cluster_client_adapter.ts index 7fd239ca493692..a036bfb74e4081 100644 --- a/x-pack/plugins/event_log/server/es/cluster_client_adapter.ts +++ b/x-pack/plugins/event_log/server/es/cluster_client_adapter.ts @@ -41,7 +41,7 @@ export class ClusterClientAdapter { public async doesIlmPolicyExist(policyName: string): Promise { const request = { method: 'GET', - path: `_ilm/policy/${policyName}`, + path: `/_ilm/policy/${policyName}`, }; try { await this.callEs('transport.request', request); @@ -55,7 +55,7 @@ export class ClusterClientAdapter { public async createIlmPolicy(policyName: string, policy: unknown): Promise { const request = { method: 'PUT', - path: `_ilm/policy/${policyName}`, + path: `/_ilm/policy/${policyName}`, body: policy, }; try {