mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 09:42:25 +00:00
adding retention months to census reports CE (#26405)
* adding retention months to census reports CE changes * using stubmaker * make fmt * change reload census agent to reload census
This commit is contained in:
@@ -1167,9 +1167,6 @@ func (c *Core) setupActivityLogLocked(ctx context.Context, wg *sync.WaitGroup) e
|
||||
manager.retentionWorker(ctx, manager.clock.Now(), months)
|
||||
close(manager.retentionDone)
|
||||
}(manager.retentionMonths)
|
||||
|
||||
manager.CensusReportDone = make(chan bool, 1)
|
||||
go c.activityLog.CensusReport(ctx, c.CensusAgent(), c.BillingStart())
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
12
vault/census_stubs_oss.go
Normal file
12
vault/census_stubs_oss.go
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
//go:build !enterprise
|
||||
|
||||
package vault
|
||||
|
||||
import "context"
|
||||
|
||||
//go:generate go run github.com/hashicorp/vault/tools/stubmaker
|
||||
|
||||
func (c *Core) StartCensusReports(ctx context.Context) {}
|
||||
@@ -2460,12 +2460,6 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c
|
||||
}
|
||||
|
||||
if !c.IsDRSecondary() {
|
||||
if !c.perfStandby {
|
||||
if err := c.setupCensusManager(); err != nil {
|
||||
logger.Error("failed to instantiate the license reporting agent", "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
// not waiting on wg to avoid changing existing behavior
|
||||
var wg sync.WaitGroup
|
||||
if err := c.setupActivityLog(ctx, &wg); err != nil {
|
||||
@@ -2473,6 +2467,12 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c
|
||||
}
|
||||
|
||||
if !c.perfStandby {
|
||||
if err := c.setupCensusManager(); err != nil {
|
||||
logger.Error("failed to instantiate the license reporting agent", "error", err)
|
||||
}
|
||||
|
||||
c.StartCensusReports(ctx)
|
||||
|
||||
c.StartManualCensusSnapshots()
|
||||
}
|
||||
|
||||
|
||||
@@ -353,6 +353,8 @@ func (b *SystemBackend) handleActivityConfigUpdate(ctx context.Context, req *log
|
||||
return nil, err
|
||||
}
|
||||
|
||||
prevRetentionMonths := config.RetentionMonths
|
||||
|
||||
{
|
||||
// Parse the default report months
|
||||
if defaultReportMonthsRaw, ok := d.GetOk("default_report_months"); ok {
|
||||
@@ -438,6 +440,11 @@ func (b *SystemBackend) handleActivityConfigUpdate(ctx context.Context, req *log
|
||||
// Set the new config on the activity log
|
||||
a.SetConfig(ctx, config)
|
||||
|
||||
// reload census agent if retention months change during update when reporting is enabled
|
||||
if prevRetentionMonths != config.RetentionMonths {
|
||||
a.core.ReloadCensus()
|
||||
}
|
||||
|
||||
if len(warnings) > 0 {
|
||||
return &logical.Response{
|
||||
Warnings: warnings,
|
||||
|
||||
Reference in New Issue
Block a user