@@ -51,9 +51,6 @@ func main() {
51
51
log .Fatal (errors .WithMessage (err , "failed to parse config" ))
52
52
}
53
53
54
- ctx , cancel := context .WithCancel (context .Background ())
55
- defer cancel ()
56
-
57
54
runner := runners .NewLocalRunner (cfg .Provision .UseSudo )
58
55
59
56
pm := pool .NewPoolManager (& cfg .PoolManager , runner )
@@ -66,10 +63,14 @@ func main() {
66
63
log .Fatal ("Failed to create a Docker client:" , err )
67
64
}
68
65
66
+ ctx , cancel := context .WithCancel (context .Background ())
67
+ defer cancel ()
68
+
69
69
// Create a platform service to make requests to Platform.
70
70
platformSvc , err := platform .New (ctx , cfg .Platform )
71
71
if err != nil {
72
- log .Fatalf (errors .WithMessage (err , "failed to create a new platform service" ))
72
+ log .Errf (errors .WithMessage (err , "failed to create a new platform service" ).Error ())
73
+ return
73
74
}
74
75
75
76
// Create a new retrieval service to prepare a data directory and start snapshotting.
@@ -80,7 +81,9 @@ func main() {
80
81
log .Err ("Failed to clean up service containers:" , cleanUpErr )
81
82
}
82
83
83
- log .Fatal ("Failed to run the data retrieval service:" , err )
84
+ log .Err ("Failed to run the data retrieval service:" , err )
85
+
86
+ return
84
87
}
85
88
86
89
defer retrievalSvc .Stop ()
@@ -93,12 +96,13 @@ func main() {
93
96
// Create a cloning service to provision new clones.
94
97
provisionSvc , err := provision .New (ctx , & cfg .Provision , dbCfg , dockerCLI , pm )
95
98
if err != nil {
96
- log .Fatalf (errors .WithMessage (err , `error in the "provision" section of the config` ))
99
+ log .Errf (errors .WithMessage (err , `error in the "provision" section of the config` ). Error ( ))
97
100
}
98
101
99
102
cloningSvc := cloning .New (& cfg .Cloning , provisionSvc )
100
103
if err = cloningSvc .Run (ctx ); err != nil {
101
- log .Fatal (err )
104
+ log .Err (err )
105
+ return
102
106
}
103
107
104
108
obs := observer .NewObserver (dockerCLI , & cfg .Observer , platformSvc .Client , pm .Active ().Pool ())
0 commit comments