fix: var-naming linter findings
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
This commit is contained in:
parent
7221812dfa
commit
ee3a670456
4 changed files with 19 additions and 21 deletions
|
|
@ -130,12 +130,12 @@ func (r *Runner) DeleteEnterprise(ctx context.Context, enterpriseID string) erro
|
|||
}
|
||||
|
||||
if len(pools) > 0 {
|
||||
poolIds := []string{}
|
||||
poolIDs := []string{}
|
||||
for _, pool := range pools {
|
||||
poolIds = append(poolIds, pool.ID)
|
||||
poolIDs = append(poolIDs, pool.ID)
|
||||
}
|
||||
|
||||
return runnerErrors.NewBadRequestError("enterprise has pools defined (%s)", strings.Join(poolIds, ", "))
|
||||
return runnerErrors.NewBadRequestError("enterprise has pools defined (%s)", strings.Join(poolIDs, ", "))
|
||||
}
|
||||
|
||||
if err := r.poolManagerCtrl.DeleteEnterprisePoolManager(enterprise); err != nil {
|
||||
|
|
|
|||
|
|
@ -144,12 +144,12 @@ func (r *Runner) DeleteOrganization(ctx context.Context, orgID string, keepWebho
|
|||
}
|
||||
|
||||
if len(pools) > 0 {
|
||||
poolIds := []string{}
|
||||
poolIDs := []string{}
|
||||
for _, pool := range pools {
|
||||
poolIds = append(poolIds, pool.ID)
|
||||
poolIDs = append(poolIDs, pool.ID)
|
||||
}
|
||||
|
||||
return runnerErrors.NewBadRequestError("org has pools defined (%s)", strings.Join(poolIds, ", "))
|
||||
return runnerErrors.NewBadRequestError("org has pools defined (%s)", strings.Join(poolIDs, ", "))
|
||||
}
|
||||
|
||||
if !keepWebhook && r.config.Default.EnableWebhookManagement {
|
||||
|
|
|
|||
|
|
@ -143,12 +143,12 @@ func (r *Runner) DeleteRepository(ctx context.Context, repoID string, keepWebhoo
|
|||
}
|
||||
|
||||
if len(pools) > 0 {
|
||||
poolIds := []string{}
|
||||
poolIDs := []string{}
|
||||
for _, pool := range pools {
|
||||
poolIds = append(poolIds, pool.ID)
|
||||
poolIDs = append(poolIDs, pool.ID)
|
||||
}
|
||||
|
||||
return runnerErrors.NewBadRequestError("repo has pools defined (%s)", strings.Join(poolIds, ", "))
|
||||
return runnerErrors.NewBadRequestError("repo has pools defined (%s)", strings.Join(poolIDs, ", "))
|
||||
}
|
||||
|
||||
if !keepWebhook && r.config.Default.EnableWebhookManagement {
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
runnerErrors "github.com/cloudbase/garm-provider-common/errors"
|
||||
commonParams "github.com/cloudbase/garm-provider-common/params"
|
||||
"github.com/cloudbase/garm-provider-common/util"
|
||||
|
|
@ -50,12 +48,12 @@ import (
|
|||
)
|
||||
|
||||
func NewRunner(ctx context.Context, cfg config.Config, db dbCommon.Store) (*Runner, error) {
|
||||
ctrlId, err := db.ControllerInfo()
|
||||
ctrlID, err := db.ControllerInfo()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "fetching controller info")
|
||||
}
|
||||
|
||||
providers, err := providers.LoadProvidersFromConfig(ctx, cfg, ctrlId.ControllerID.String())
|
||||
providers, err := providers.LoadProvidersFromConfig(ctx, cfg, ctrlID.ControllerID.String())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "loading providers")
|
||||
}
|
||||
|
|
@ -67,7 +65,7 @@ func NewRunner(ctx context.Context, cfg config.Config, db dbCommon.Store) (*Runn
|
|||
}
|
||||
|
||||
poolManagerCtrl := &poolManagerCtrl{
|
||||
controllerID: ctrlId.ControllerID.String(),
|
||||
controllerID: ctrlID.ControllerID.String(),
|
||||
config: cfg,
|
||||
credentials: creds,
|
||||
repositories: map[string]common.PoolManager{},
|
||||
|
|
@ -81,7 +79,7 @@ func NewRunner(ctx context.Context, cfg config.Config, db dbCommon.Store) (*Runn
|
|||
poolManagerCtrl: poolManagerCtrl,
|
||||
providers: providers,
|
||||
credentials: creds,
|
||||
controllerID: ctrlId.ControllerID,
|
||||
controllerID: ctrlID.ControllerID,
|
||||
}
|
||||
|
||||
if err := runner.loadReposOrgsAndEnterprises(); err != nil {
|
||||
|
|
@ -628,34 +626,34 @@ func (r *Runner) Wait() error {
|
|||
return errors.Wrap(err, "fetch enterprise pool managers")
|
||||
}
|
||||
|
||||
for poolId, repo := range repos {
|
||||
for poolID, repo := range repos {
|
||||
wg.Add(1)
|
||||
go func(id string, poolMgr common.PoolManager) {
|
||||
defer wg.Done()
|
||||
if err := poolMgr.Wait(); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(r.ctx, "timed out waiting for pool manager to exit", "pool_id", id, "pool_mgr_id", poolMgr.ID())
|
||||
}
|
||||
}(poolId, repo)
|
||||
}(poolID, repo)
|
||||
}
|
||||
|
||||
for poolId, org := range orgs {
|
||||
for poolID, org := range orgs {
|
||||
wg.Add(1)
|
||||
go func(id string, poolMgr common.PoolManager) {
|
||||
defer wg.Done()
|
||||
if err := poolMgr.Wait(); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(r.ctx, "timed out waiting for pool manager to exit", "pool_id", id)
|
||||
}
|
||||
}(poolId, org)
|
||||
}(poolID, org)
|
||||
}
|
||||
|
||||
for poolId, enterprise := range enterprises {
|
||||
for poolID, enterprise := range enterprises {
|
||||
wg.Add(1)
|
||||
go func(id string, poolMgr common.PoolManager) {
|
||||
defer wg.Done()
|
||||
if err := poolMgr.Wait(); err != nil {
|
||||
slog.With(slog.Any("error", err)).ErrorContext(r.ctx, "timed out waiting for pool manager to exit", "pool_id", id)
|
||||
}
|
||||
}(poolId, enterprise)
|
||||
}(poolID, enterprise)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue