mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Fix upgrade assistant warning for optional roles and roleTemplate properties (#179818)
Closes https://github.com/elastic/kibana/issues/177065 ## Summary Upgrade assistant in cloud shows a warning when trying to upgrade due to mutually exclusive `roles` and `roleTemplates` property in the `Get Role Mappings` API from ES. This PR fixes that by introducing conditional checks for where we check for the `roles` property. ## Release notes Fix warning displayed in Upgrade Assistant regarding `roles` and `roleTemplate` properties when checking response from Get Role Mappings API. --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kurt <kc13greiner@users.noreply.github.com>
This commit is contained in:
parent
f04153ba2c
commit
597ab88d9e
3 changed files with 3 additions and 3 deletions
|
@ -211,7 +211,7 @@ async function getRoleMappingsDeprecations(
|
|||
const roleMappingsWithReportingRole: string[] = Object.entries(roleMappings).reduce(
|
||||
(roleSet, current) => {
|
||||
const [roleName, role] = current;
|
||||
const foundMapping = role.roles.find((roll) => deprecatedRoles.includes(roll));
|
||||
const foundMapping = role.roles?.find((roll) => deprecatedRoles.includes(roll));
|
||||
if (foundMapping) {
|
||||
roleSet.push(`${roleName}[${foundMapping}]`);
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ async function getRoleMappingsDeprecations(
|
|||
}
|
||||
|
||||
const roleMappingsWithKibanaUserRole = Object.entries(roleMappings)
|
||||
.filter(([, roleMapping]) => roleMapping.roles.includes(KIBANA_USER_ROLE_NAME))
|
||||
.filter(([, roleMapping]) => roleMapping.roles?.includes(KIBANA_USER_ROLE_NAME))
|
||||
.map(([mappingName]) => mappingName);
|
||||
if (roleMappingsWithKibanaUserRole.length === 0) {
|
||||
return [];
|
||||
|
|
|
@ -100,7 +100,7 @@ export function defineKibanaUserRoleDeprecationRoutes({ router, logger }: RouteD
|
|||
}
|
||||
|
||||
const roleMappingsWithKibanaUserRole = Object.entries(roleMappings).filter(([, mapping]) =>
|
||||
mapping.roles.includes(KIBANA_USER_ROLE_NAME)
|
||||
mapping.roles?.includes(KIBANA_USER_ROLE_NAME)
|
||||
);
|
||||
|
||||
if (roleMappingsWithKibanaUserRole.length === 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue