fix(console): remove unsupported --tenant flag from CrowdSec console enrollment command

This commit is contained in:
GitHub Actions
2025-12-11 15:37:46 +00:00
parent 8687a05ec0
commit b4dd1efe3c
4 changed files with 64 additions and 507 deletions
+2 -5
View File
@@ -94,10 +94,10 @@ type ConsoleEnrollmentService struct {
}
// NewConsoleEnrollmentService constructs a service using the supplied secret material for encryption.
func NewConsoleEnrollmentService(db *gorm.DB, exec EnvCommandExecutor, dataDir, secret string) *ConsoleEnrollmentService {
func NewConsoleEnrollmentService(db *gorm.DB, executor EnvCommandExecutor, dataDir, secret string) *ConsoleEnrollmentService {
return &ConsoleEnrollmentService{
db: db,
exec: exec,
exec: executor,
dataDir: dataDir,
key: deriveKey(secret),
nowFn: time.Now,
@@ -172,9 +172,6 @@ func (s *ConsoleEnrollmentService) Enroll(ctx context.Context, req ConsoleEnroll
defer cancel()
args := []string{"console", "enroll", "--name", agent}
if tenant != "" {
args = append(args, "--tenant", tenant)
}
logger.Log().WithField("tenant", tenant).WithField("agent", agent).WithField("correlation_id", rec.LastCorrelationID).Info("starting crowdsec console enrollment")
out, cmdErr := s.exec.ExecuteWithEnv(cmdCtx, "cscli", args, map[string]string{"CROWDSEC_CONSOLE_ENROLL_KEY": token})