mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Use global options as default for new teams (#1184)
When creating a new Team, copy the global options so that the Team is not initialized with null options.
This commit is contained in:
parent
1417d01407
commit
763e69bc81
1 changed files with 10 additions and 2 deletions
|
|
@ -15,7 +15,14 @@ func (svc *Service) NewTeam(ctx context.Context, p fleet.TeamPayload) (*fleet.Te
|
|||
return nil, err
|
||||
}
|
||||
|
||||
team := &fleet.Team{}
|
||||
// Copy team options from global options
|
||||
globalConfig, err := svc.ds.AppConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
team := &fleet.Team{
|
||||
AgentOptions: globalConfig.AgentOptions,
|
||||
}
|
||||
|
||||
if p.Name == nil {
|
||||
return nil, fleet.NewInvalidArgumentError("name", "missing required argument")
|
||||
|
|
@ -39,7 +46,8 @@ func (svc *Service) NewTeam(ctx context.Context, p fleet.TeamPayload) (*fleet.Te
|
|||
}
|
||||
team.Secrets = []*fleet.EnrollSecret{{Secret: secret}}
|
||||
}
|
||||
team, err := svc.ds.NewTeam(team)
|
||||
|
||||
team, err = svc.ds.NewTeam(team)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue