send protocol separately to agent as part of full agent policy (#79781)
This commit is contained in:
parent
7031ea4f7b
commit
041dfdd89d
|
@ -64,6 +64,7 @@ export interface FullAgentPolicy {
|
|||
fleet?: {
|
||||
kibana: {
|
||||
hosts: string[];
|
||||
protocol: string;
|
||||
};
|
||||
};
|
||||
inputs: FullAgentPolicyInput[];
|
||||
|
|
|
@ -81,7 +81,8 @@ describe('agent policy', () => {
|
|||
revision: 1,
|
||||
fleet: {
|
||||
kibana: {
|
||||
hosts: ['http://localhost:5603'],
|
||||
hosts: ['localhost:5603'],
|
||||
protocol: 'http',
|
||||
},
|
||||
},
|
||||
agent: {
|
||||
|
@ -115,7 +116,8 @@ describe('agent policy', () => {
|
|||
revision: 1,
|
||||
fleet: {
|
||||
kibana: {
|
||||
hosts: ['http://localhost:5603'],
|
||||
hosts: ['localhost:5603'],
|
||||
protocol: 'http',
|
||||
},
|
||||
},
|
||||
agent: {
|
||||
|
@ -150,7 +152,8 @@ describe('agent policy', () => {
|
|||
revision: 1,
|
||||
fleet: {
|
||||
kibana: {
|
||||
hosts: ['http://localhost:5603'],
|
||||
hosts: ['localhost:5603'],
|
||||
protocol: 'http',
|
||||
},
|
||||
},
|
||||
agent: {
|
||||
|
|
|
@ -538,10 +538,16 @@ class AgentPolicyService {
|
|||
} catch (error) {
|
||||
throw new Error('Default settings is not setup');
|
||||
}
|
||||
if (!settings.kibana_urls) throw new Error('kibana_urls is missing');
|
||||
if (!settings.kibana_urls || !settings.kibana_urls.length)
|
||||
throw new Error('kibana_urls is missing');
|
||||
const hostsWithoutProtocol = settings.kibana_urls.map((url) => {
|
||||
const parsedURL = new URL(url);
|
||||
return `${parsedURL.host}${parsedURL.pathname !== '/' ? parsedURL.pathname : ''}`;
|
||||
});
|
||||
fullAgentPolicy.fleet = {
|
||||
kibana: {
|
||||
hosts: settings.kibana_urls,
|
||||
protocol: new URL(settings.kibana_urls[0]).protocol.replace(':', ''),
|
||||
hosts: hostsWithoutProtocol,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
const { protocol, hostname, port } = kbnTestServer;
|
||||
|
||||
const kibanaUrl = Url.format({
|
||||
protocol,
|
||||
hostname,
|
||||
port,
|
||||
});
|
||||
|
@ -237,6 +236,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
fleet: {
|
||||
kibana: {
|
||||
hosts: [kibanaUrl],
|
||||
protocol,
|
||||
},
|
||||
},
|
||||
revision: 3,
|
||||
|
|
Loading…
Reference in a new issue