Merge pull request #664 from gravitl/bugfix_v0.10.0_unique_macaddress

check for unique mac address on node creation
This commit is contained in:
dcarns 2022-02-02 19:10:30 -05:00 committed by GitHub
commit 8de15efcc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ import (
"errors"
"time"
"github.com/gravitl/netmaker/functions"
nodepb "github.com/gravitl/netmaker/grpc"
"github.com/gravitl/netmaker/logger"
"github.com/gravitl/netmaker/logic"
@ -68,6 +69,10 @@ func (s *NodeServiceServer) CreateNode(ctx context.Context, req *nodepb.Object)
return nil, errors.New("invalid key, and network does not allow no-key signups")
}
}
unique, _ := functions.IsMacAddressUnique(node.MacAddress, node.Network)
if !unique {
return nil, errors.New("macaddress is not unique")
}
getServerAddrs(&node)