atc: fix two creds manager instantiated
concourse/concourse#3448
@@ -391,7 +391,12 @@ func (cmd *RunCommand) Runner(positionalArguments []string) (ifrit.Runner, error
return nil, err
}
- members, err := cmd.constructMembers(logger, reconfigurableSink, apiConn, backendConn, storage, lockFactory)
+ variablesFactory, err := cmd.variablesFactory(logger)
+ if err != nil {
+ return nil, err
+ }
+
+ members, err := cmd.constructMembers(logger, reconfigurableSink, apiConn, backendConn, storage, lockFactory, variablesFactory)
if err != nil {
return nil, err
}
@@ -433,6 +438,7 @@ func (cmd *RunCommand) constructMembers(
backendConn db.Conn,
storage storage.Storage,
lockFactory lock.LockFactory,
+ variablesFactory creds.VariablesFactory,
) ([]grouper.Member, error) {
if cmd.TelemetryOptIn {
url := fmt.Sprintf("http://telemetry.concourse-ci.org/?version=%s", concourse.Version)
@@ -444,12 +450,12 @@ func (cmd *RunCommand) constructMembers(
}()
}
- apiMembers, err := cmd.constructAPIMembers(logger, reconfigurableSink, apiConn, storage, lockFactory)
+ apiMembers, err := cmd.constructAPIMembers(logger, reconfigurableSink, apiConn, storage, lockFactory, variablesFactory)
if err != nil {
return nil, err
}
- backendMembers, err := cmd.constructBackendMembers(logger, backendConn, lockFactory)
+ backendMembers, err := cmd.constructBackendMembers(logger, backendConn, lockFactory, variablesFactory)
if err != nil {
return nil, err
}
@@ -463,6 +469,7 @@ func (cmd *RunCommand) constructAPIMembers(
dbConn db.Conn,
storage storage.Storage,
lockFactory lock.LockFactory,
+ variablesFactory creds.VariablesFactory,
) ([]grouper.Member, error) {
teamFactory := db.NewTeamFactory(dbConn, lockFactory)
@@ -531,11 +538,6 @@ func (cmd *RunCommand) constructAPIMembers(
pool := worker.NewPool(workerProvider)
workerClient := worker.NewClient(pool, workerProvider)
- variablesFactory, err := cmd.variablesFactory(logger)
- if err != nil {
- return nil, err
- }
-
checkContainerStrategy := worker.NewRandomPlacementStrategy()
radarScannerFactory := radar.NewScannerFactory(
@@ -661,6 +663,7 @@ func (cmd *RunCommand) constructBackendMembers(
logger lager.Logger,
dbConn db.Conn,
lockFactory lock.LockFactory,
+ variablesFactory creds.VariablesFactory,
) ([]grouper.Member, error) {
if cmd.Syslog.Address != "" && cmd.Syslog.Transport == "" {
@@ -720,11 +723,6 @@ func (cmd *RunCommand) constructBackendMembers(
return nil, err
}
- variablesFactory, err := cmd.variablesFactory(logger)
- if err != nil {
- return nil, err
- }
-
buildContainerStrategy := cmd.chooseBuildContainerStrategy()
checkContainerStrategy := worker.NewRandomPlacementStrategy()
