fix validator for type not being inverted

This commit is contained in:
Matthew Stobbs 2024-10-05 18:04:28 -06:00
parent 0e4757c7b7
commit 8bcb14a8af
2 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ func ReserveV4MacAddr(identifierType string, identifier string, addr string, hos
// This does not validate against the database, just validates that the written configuration // This does not validate against the database, just validates that the written configuration
// is correct // is correct
func (r *ReservationV4) Validate() bool { func (r *ReservationV4) Validate() bool {
if typeValidator.IsValid(r.typeName) { if !typeValidator.IsValid(r.typeName) {
slog.Error("validate", slog.Any("reservationV4.type", "invalid")) slog.Error("validate", slog.Any("reservationV4.type", "invalid"))
return false return false
} }

View File

@ -3,5 +3,5 @@ package types
import "git.staur.ca/stobbsm/kea-manage/lib/types" import "git.staur.ca/stobbsm/kea-manage/lib/types"
func IsValid(identifierType string) bool { func IsValid(identifierType string) bool {
return types.LookupIdentifier(identifierType) != 255 return types.LookupIdentifier(identifierType) != types.Invalid
} }