@@ -32,12 +32,12 @@ import (
3232 "time"
3333 "sync"
3434
35+ "github.com/AliceO2Group/Control/core/confsys"
3536 "github.com/mesos/mesos-go/api/v1/lib"
3637 "github.com/mesos/mesos-go/api/v1/lib/backoff"
3738 "github.com/mesos/mesos-go/api/v1/lib/scheduler/calls"
3839 "github.com/looplab/fsm"
3940 "github.com/AliceO2Group/Control/core/environment"
40- "github.com/AliceO2Group/Control/configuration"
4141 "encoding/json"
4242 "github.com/AliceO2Group/Control/core/controlcommands"
4343 "context"
@@ -61,9 +61,12 @@ func newInternalState(cfg Config, shutdown func()) (*internalState, error) {
6161 return nil , err
6262 }
6363
64- cfgman , err := configuration .NewSource (cfg .configurationUri )
64+ confSvc , err := confsys .NewService (cfg .configurationUri )
65+ if err != nil {
66+ return nil , err
67+ }
6568 if cfg .veryVerbose {
66- cfgDump , err := cfgman .GetRecursive ("o2/control" )
69+ cfgDump , err := confSvc . GetROSource () .GetRecursive ("o2/control" )
6770 if err != nil {
6871 log .WithError (err ).Fatal ("cannot retrieve configuration" )
6972 return nil , err
@@ -75,9 +78,6 @@ func newInternalState(cfg Config, shutdown func()) (*internalState, error) {
7578 }
7679 log .WithField ("data" , string (cfgBytes )).Debug ("configuration dump" )
7780 }
78- if err != nil {
79- return nil , err
80- }
8181
8282 resourceOffersDone := make (chan task.DeploymentMap )
8383 tasksToDeploy := make (chan task.Descriptors )
@@ -96,7 +96,7 @@ func newInternalState(cfg Config, shutdown func()) (*internalState, error) {
9696 random : rand .New (rand .NewSource (time .Now ().Unix ())),
9797 shutdown : shutdown ,
9898 environments : nil ,
99- cfgman : cfgman ,
99+ confSvc : confSvc ,
100100 }
101101
102102 state .servent = controlcommands .NewServent (
@@ -106,14 +106,14 @@ func newInternalState(cfg Config, shutdown func()) (*internalState, error) {
106106 )
107107 state .commandqueue = controlcommands .NewCommandQueue (state .servent )
108108
109- taskman := task .NewManager (cfgman , resourceOffersDone ,
109+ taskman := task .NewManager (confSvc . GetROSource () , resourceOffersDone ,
110110 tasksToDeploy , reviveOffersTrg , state .commandqueue )
111111 err = taskman .RefreshClasses ()
112112 if err != nil {
113113 log .WithField ("error" , err ).Warning ("bad configuration, some task templates were not refreshed" )
114114 }
115115 state .taskman = taskman
116- state .environments = environment .NewEnvManager (state .taskman , state . cfgman )
116+ state .environments = environment .NewEnvManager (state .taskman , confSvc )
117117 state .commandqueue .Start () // FIXME: there should be 1 cq per env
118118
119119 return state , nil
@@ -149,8 +149,9 @@ type internalState struct {
149149 sm * fsm.FSM
150150 environments * environment.Manager
151151 taskman * task.Manager
152- cfgman configuration.Source
153152 commandqueue * controlcommands.CommandQueue
154153 servent * controlcommands.Servent
154+
155+ confSvc * confsys.Service
155156}
156157
0 commit comments