1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 06:49:40 +02:00

feat(license): remove untrusted devices from node count [EE-5357] (#8817)

This commit is contained in:
Chaim Lev-Ari 2023-05-05 09:02:31 +07:00 committed by GitHub
parent 5f6ddc2fad
commit cfed481d6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 102 additions and 35 deletions

View file

@ -2,13 +2,16 @@ package status
import (
portainer "github.com/portainer/portainer/api"
"github.com/portainer/portainer/api/internal/endpointutils"
)
// NodesCount returns the total node number of all environments
func NodesCount(endpoints []portainer.Endpoint) int {
nodes := 0
for _, env := range endpoints {
nodes += countNodes(&env)
if !endpointutils.IsEdgeEndpoint(&env) || env.UserTrusted {
nodes += countNodes(&env)
}
}
return nodes