Skip to content

Commit

Permalink
[8.14] [Fleet] Fix cloudflare template error (#182645) (#182654)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.14`:
- [[Fleet] Fix cloudflare template error
(#182645)](#182645)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-05-06T10:19:13Z","message":"[Fleet]
Fix cloudflare template error (#182645)\n\n## Summary\r\n\r\nCloudflare
8.24 doesn't install properly and the config tab also fails\r\nwith the
same error. This PR fixes this error and also fixes a small UI\r\nissue
with max width not sets in configs tab.\r\n\r\nThe integration defines
two possible options for auth (auth key or\r\ntoken) but only one should
be used. When both are set the
[compile\r\ntemplate](https://github.com/elastic/kibana/blob/be3f66fd45db4001b9437281a2cb075e817fa25f/x-pack/plugins/fleet/server/services/epm/agent/agent.ts#L27)\r\nfails
with an error\r\n\r\n## Before\r\n![Screenshot 2024-05-03 at 16
16\r\n35](https://github.com/elastic/kibana/assets/16084106/cb90e72a-7cef-46eb-8542-324cce45ac37)\r\n![Screenshot
2024-05-03 at 16
20\r\n01](https://github.com/elastic/kibana/assets/16084106/4ffacea4-ffa7-4a1a-bf81-24213fee48f3)\r\n\r\n##
After\r\n![Screenshot 2024-05-06 at 10
58\r\n57](https://github.com/elastic/kibana/assets/16084106/36ca8bea-87d7-4d01-8fda-50190feb9fbb)","sha":"1a3ff70c5e7ebdc308fe5022acee178a43302dc5","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","backport:prev-minor","v8.15.0"],"title":"[Fleet]
Fix cloudflare template
error","number":182645,"url":"https://github.com/elastic/kibana/pull/182645","mergeCommit":{"message":"[Fleet]
Fix cloudflare template error (#182645)\n\n## Summary\r\n\r\nCloudflare
8.24 doesn't install properly and the config tab also fails\r\nwith the
same error. This PR fixes this error and also fixes a small UI\r\nissue
with max width not sets in configs tab.\r\n\r\nThe integration defines
two possible options for auth (auth key or\r\ntoken) but only one should
be used. When both are set the
[compile\r\ntemplate](https://github.com/elastic/kibana/blob/be3f66fd45db4001b9437281a2cb075e817fa25f/x-pack/plugins/fleet/server/services/epm/agent/agent.ts#L27)\r\nfails
with an error\r\n\r\n## Before\r\n![Screenshot 2024-05-03 at 16
16\r\n35](https://github.com/elastic/kibana/assets/16084106/cb90e72a-7cef-46eb-8542-324cce45ac37)\r\n![Screenshot
2024-05-03 at 16
20\r\n01](https://github.com/elastic/kibana/assets/16084106/4ffacea4-ffa7-4a1a-bf81-24213fee48f3)\r\n\r\n##
After\r\n![Screenshot 2024-05-06 at 10
58\r\n57](https://github.com/elastic/kibana/assets/16084106/36ca8bea-87d7-4d01-8fda-50190feb9fbb)","sha":"1a3ff70c5e7ebdc308fe5022acee178a43302dc5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/182645","number":182645,"mergeCommit":{"message":"[Fleet]
Fix cloudflare template error (#182645)\n\n## Summary\r\n\r\nCloudflare
8.24 doesn't install properly and the config tab also fails\r\nwith the
same error. This PR fixes this error and also fixes a small UI\r\nissue
with max width not sets in configs tab.\r\n\r\nThe integration defines
two possible options for auth (auth key or\r\ntoken) but only one should
be used. When both are set the
[compile\r\ntemplate](https://github.com/elastic/kibana/blob/be3f66fd45db4001b9437281a2cb075e817fa25f/x-pack/plugins/fleet/server/services/epm/agent/agent.ts#L27)\r\nfails
with an error\r\n\r\n## Before\r\n![Screenshot 2024-05-03 at 16
16\r\n35](https://github.com/elastic/kibana/assets/16084106/cb90e72a-7cef-46eb-8542-324cce45ac37)\r\n![Screenshot
2024-05-03 at 16
20\r\n01](https://github.com/elastic/kibana/assets/16084106/4ffacea4-ffa7-4a1a-bf81-24213fee48f3)\r\n\r\n##
After\r\n![Screenshot 2024-05-06 at 10
58\r\n57](https://github.com/elastic/kibana/assets/16084106/36ca8bea-87d7-4d01-8fda-50190feb9fbb)","sha":"1a3ff70c5e7ebdc308fe5022acee178a43302dc5"}}]}]
BACKPORT-->

Co-authored-by: Cristina Amico <[email protected]>
  • Loading branch information
kibanamachine and criamico authored May 6, 2024
1 parent 0db0297 commit 9570bf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/
import React from 'react';
import styled from 'styled-components';
import {
EuiFlexGroup,
EuiFlexItem,
Expand All @@ -27,6 +28,10 @@ import { PrereleaseCallout } from '../overview/overview';

import { isPackagePrerelease } from '../../../../../../../../common/services';

const FlexItemWithMaxWidth = styled(EuiFlexItem)`
max-width: 1000px;
`;

interface ConfigsProps {
packageInfo: PackageInfo;
}
Expand Down Expand Up @@ -57,7 +62,7 @@ export const Configs: React.FC<ConfigsProps> = ({ packageInfo }) => {
return (
<EuiFlexGroup data-test-subj="epm.Configs" alignItems="flexStart">
<EuiFlexItem grow={1} />
<EuiFlexItem grow={6}>
<FlexItemWithMaxWidth grow={6}>
{isLoading && !configs ? (
<EuiSkeletonText lines={10} />
) : (
Expand Down Expand Up @@ -117,7 +122,7 @@ export const Configs: React.FC<ConfigsProps> = ({ packageInfo }) => {
</EuiCodeBlock>
</>
)}
</EuiFlexItem>
</FlexItemWithMaxWidth>
</EuiFlexGroup>
);
};
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/server/services/epm/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ handlebars.registerHelper('contains', containsHelper);
// and to respect any incoming newline we also need to double them, otherwise
// they will be replaced with a space.
function escapeStringHelper(str: string) {
if (!str) return undefined;
return "'" + str.replace(/\'/g, "''").replace(/\n/g, '\n\n') + "'";
}
handlebars.registerHelper('escape_string', escapeStringHelper);
Expand Down

0 comments on commit 9570bf0

Please sign in to comment.