Skip to content

Commit

Permalink
Override isEnabledByDefault() for cluster manager role
Browse files Browse the repository at this point in the history
Signed-off-by: Sandesh Kumar <[email protected]>
  • Loading branch information
sandeshkr419 committed Mar 24, 2023
1 parent 306e6a9 commit 10493ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,7 @@ public static Set<DiscoveryNodeRole> getRolesFromSettings(final Settings setting
validateLegacySettings(settings, roleMap);
return Collections.unmodifiableSet(new HashSet<>(NODE_ROLES_SETTING.get(settings)));
} else {
return roleMap.values()
.stream()
.filter(
s -> !s.roleName().equals(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE.roleName())
&& s.legacySetting() != null
&& s.legacySetting().get(settings)
)
.collect(Collectors.toSet());
return roleMap.values().stream().filter(s -> s.isEnabledByDefault(settings)).collect(Collectors.toSet());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.Booleans;
import org.opensearch.common.logging.DeprecationLogger;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Setting.Property;
Expand Down Expand Up @@ -275,7 +276,7 @@ public void validateRole(List<DiscoveryNodeRole> roles) {

@Override
public boolean isEnabledByDefault(final Settings settings) {
return settings.getAsBoolean("node.master", true);
return !Booleans.isBoolean(settings.get("node.master"));
}
};

Expand Down

0 comments on commit 10493ee

Please sign in to comment.