diff --git a/internal/server/db/cluster/profiles.go b/internal/server/db/cluster/profiles.go index c0c23dafddf..5b53aa7bd81 100644 --- a/internal/server/db/cluster/profiles.go +++ b/internal/server/db/cluster/profiles.go @@ -55,25 +55,25 @@ type ProfileFilter struct { func (p *Profile) ToAPI(ctx context.Context, tx *sql.Tx, profileConfigs map[int]map[string]string, profileDevices map[int][]Device) (*api.Profile, error) { var err error - var config map[string]string + var dbConfig map[string]string if profileConfigs != nil { - config = profileConfigs[p.ID] + dbConfig = profileConfigs[p.ID] } else { - config, err = GetProfileConfig(ctx, tx, p.ID) + dbConfig, err = GetProfileConfig(ctx, tx, p.ID) if err != nil { return nil, err } } - var devices map[string]Device + var dbDevices map[string]Device if profileDevices != nil { - devices = map[string]Device{} + dbDevices = map[string]Device{} for _, dev := range profileDevices[p.ID] { - devices[dev.Name] = dev + dbDevices[dev.Name] = dev } } else { - devices, err = GetProfileDevices(ctx, tx, p.ID) + dbDevices, err = GetProfileDevices(ctx, tx, p.ID) if err != nil { return nil, err } @@ -83,8 +83,8 @@ func (p *Profile) ToAPI(ctx context.Context, tx *sql.Tx, profileConfigs map[int] Name: p.Name, ProfilePut: api.ProfilePut{ Description: p.Description, - Config: config, - Devices: DevicesToAPI(devices), + Config: dbConfig, + Devices: DevicesToAPI(dbDevices), }, Project: p.Project, }