Prevent partition-exports entry from OSS usage
Validation was added on the config entry kind since that is called when validating config entries to bootstrap via agent configuration and when applying entries via the config RPC endpoint.
This commit is contained in:
parent
48954adfdc
commit
6d51282adf
|
@ -113,7 +113,12 @@ func (e *PartitionExportsConfigEntry) Validate() error {
|
|||
return fmt.Errorf("partition-exports Name must be the name of a partition, and not a wildcard")
|
||||
}
|
||||
|
||||
validationErr := validateConfigEntryMeta(e.Meta)
|
||||
if err := requireEnterprise(e.GetKind()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateConfigEntryMeta(e.Meta); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, svc := range e.Services {
|
||||
if svc.Name == "" {
|
||||
|
@ -128,8 +133,7 @@ func (e *PartitionExportsConfigEntry) Validate() error {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return validationErr
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *PartitionExportsConfigEntry) CanRead(authz acl.Authorizer) bool {
|
||||
|
|
|
@ -35,3 +35,7 @@ func validateUnusedKeys(unused []string) error {
|
|||
func validateInnerEnterpriseMeta(_, _ *EnterpriseMeta) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func requireEnterprise(kind string) error {
|
||||
return fmt.Errorf("Config entry kind %q requires Consul Enterprise", kind)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue