Skip to content

Commit

Permalink
[8.x] [Agentless] Fix agentless global_data_tags (#199247) (#199324)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Agentless] Fix agentless global_data_tags
(#199247)](#199247)

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

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

<!--BACKPORT [{"author":{"name":"Paulo
Silva","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-07T14:32:47Z","message":"[Agentless]
Fix agentless global_data_tags
(#199247)","sha":"ef205b88888aa2240951de1a750b33dcec77c6b4","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","Team:Cloud
Security","backport:version","v8.17.0"],"title":"[Agentless] Fix
agentless
global_data_tags","number":199247,"url":"https://github.com/elastic/kibana/pull/199247","mergeCommit":{"message":"[Agentless]
Fix agentless global_data_tags
(#199247)","sha":"ef205b88888aa2240951de1a750b33dcec77c6b4"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199247","number":199247,"mergeCommit":{"message":"[Agentless]
Fix agentless global_data_tags
(#199247)","sha":"ef205b88888aa2240951de1a750b33dcec77c6b4"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Paulo Silva <[email protected]>
  • Loading branch information
kibanamachine and opauloh authored Nov 7, 2024
1 parent c8d1228 commit 17fac23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,11 @@ describe('Agentless Agent service', () => {
policy_id: 'mocked-agentless-agent-policy-id',
stack_version: 'mocked-kibana-version-infinite',
labels: {
organization: 'elastic',
division: 'cloud',
team: 'fleet',
owner: {
org: 'elastic',
division: 'cloud',
team: 'fleet',
},
},
}),
headers: expect.anything(),
Expand Down Expand Up @@ -911,9 +913,11 @@ describe('Agentless Agent service', () => {
fleet_url: 'http://fleetserver:8220',
policy_id: 'mocked-agentless-agent-policy-id',
labels: {
organization: 'elastic',
division: 'cloud',
team: 'fleet',
owner: {
org: 'elastic',
division: 'cloud',
team: 'fleet',
},
},
},
headers: expect.anything(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,11 @@ class AgentlessAgentService {
agentlessAgentPolicy.global_data_tags?.find((tag) => tag.name === name)?.value;

return {
organization: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_ORGANIZATION),
division: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_DIVISION),
team: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_TEAM),
owner: {
org: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_ORGANIZATION),
division: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_DIVISION),
team: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_TEAM),
},
};
}

Expand Down

0 comments on commit 17fac23

Please sign in to comment.