From 740a7f9e6a02c419a31822dde02c948b98b5495e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 17 Oct 2024 02:42:28 -0400 Subject: [PATCH] lxd/db/cluster/profiles: Fix import shadowing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber Sponsored-by: https://webdock.io (cherry picked from commit 8261a78dd1134a7a41e704361b271b328c05388a) Signed-off-by: hamistao License: Apache-2.0 --- lxd/db/cluster/profiles.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lxd/db/cluster/profiles.go b/lxd/db/cluster/profiles.go index 2cadd874a987..9f05eabac2f4 100644 --- a/lxd/db/cluster/profiles.go +++ b/lxd/db/cluster/profiles.go @@ -54,28 +54,28 @@ 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] - if config == nil { - config = map[string]string{} + dbConfig = profileConfigs[p.ID] + if dbConfig == nil { + dbConfig = map[string]string{} } } 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 } @@ -84,8 +84,8 @@ func (p *Profile) ToAPI(ctx context.Context, tx *sql.Tx, profileConfigs map[int] profile := &api.Profile{ Name: p.Name, Description: p.Description, - Config: config, - Devices: DevicesToAPI(devices), + Config: dbConfig, + Devices: DevicesToAPI(dbDevices), } return profile, nil