File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ type Timestamps struct {
18
18
Bundles map [string ]string `json:"Bundles"`
19
19
}
20
20
21
+ func createEmptyTimestamps () * Timestamps {
22
+ return & Timestamps {DeploymentConfig : "" , Bundles : map [string ]string {}}
23
+ }
24
+
21
25
func VerifyDeploymentConfigTimestamp (newTimestamp , filePath string ) {
22
26
timestamps := readTimestamps (filePath )
23
27
timestamps .CheckAndSetDeploymentConfigTimestamp (newTimestamp )
@@ -36,7 +40,7 @@ func readTimestamps(filePath string) *Timestamps {
36
40
if os .IsNotExist (err ) {
37
41
log .WithFields (log.Fields {"err" : err , "filePath" : filePath }).Infof ("Could not read timestamps " +
38
42
"because the file does not yet exist: looks like this is the first run of the launcher." )
39
- return & Timestamps { DeploymentConfig : "" , Bundles : map [ string ] string {}}
43
+ return createEmptyTimestamps ()
40
44
}
41
45
panic (err )
42
46
}
@@ -64,7 +68,8 @@ func ReadTimestampsFromReader(reader io.Reader) *Timestamps {
64
68
var timestamps Timestamps
65
69
err = json .Unmarshal (bytes , & timestamps )
66
70
if err != nil {
67
- panic (fmt .Sprintf ("Could not unmarshal timestamps `%s`: %v" , string (bytes ), err ))
71
+ log .Warnf ("Ignoring timestamps: Could not unmarshal timestamps `%s`: %v" , string (bytes ), err )
72
+ return createEmptyTimestamps ()
68
73
}
69
74
return & timestamps
70
75
}
You can’t perform that action at this time.
0 commit comments