Bring back entmeta args defaulting

This commit is contained in:
freddygv 2021-09-15 15:17:11 -06:00
parent 99c6e4fe41
commit cecf5b18f8
1 changed files with 14 additions and 0 deletions

View File

@ -527,6 +527,20 @@ func (c *cmd) generateConfig() ([]byte, error) {
args.ProxySourceService = svc.Service args.ProxySourceService = svc.Service
} }
// In most cases where namespaces and partitions are enabled they will already be set
// correctly because the http client that fetched this will provide them explicitly.
// However, if these arguments were not provided, they will be empty even
// though Namespaces and Partitions are actually being used.
// Overriding them ensures that we always set the Namespace and Partition args
// if the cluster is using them. This prevents us from defaulting to the "default"
// when a non-default partition or namespace was inferred from the ACL token.
if svc.Namespace != "" {
args.Namespace = svc.Namespace
}
if svc.Partition != "" {
args.Partition = svc.Partition
}
if svc.Datacenter != "" { if svc.Datacenter != "" {
// The agent will definitely have the definitive answer here. // The agent will definitely have the definitive answer here.
args.Datacenter = svc.Datacenter args.Datacenter = svc.Datacenter