Commit 3cebde92 authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Handle empty entries in bootstrap path map

parent a93b9b6d
...@@ -325,9 +325,11 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker, ...@@ -325,9 +325,11 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker,
results := make(map[string]update) results := make(map[string]update)
for pathKey, fileData := range files { for pathKey, fileData := range files {
path, ok := paths[pathKey] path, ok := paths[pathKey]
if !ok { if !ok || path == "" {
logrus.Warnf("Unable to lookup path to reconcile %s", pathKey)
continue continue
} }
logrus.Debugf("Reconciling %s at '%s'", pathKey, path)
f, err := os.Open(path) f, err := os.Open(path)
if err != nil { if err != nil {
...@@ -439,7 +441,7 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker, ...@@ -439,7 +441,7 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker,
switch { switch {
case res.disk: case res.disk:
updateDisk = true updateDisk = true
logrus.Warn("datastore newer than " + path) logrus.Warn("Datastore newer than " + path)
case res.db: case res.db:
if c.config.ClusterReset { if c.config.ClusterReset {
logrus.Infof("Cluster reset: replacing file on disk: " + path) logrus.Infof("Cluster reset: replacing file on disk: " + path)
...@@ -448,7 +450,7 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker, ...@@ -448,7 +450,7 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker,
} }
newerOnDisk = append(newerOnDisk, path) newerOnDisk = append(newerOnDisk, path)
case res.conflict: case res.conflict:
logrus.Warnf("datastore / disk conflict: %s newer than in the datastore", path) logrus.Warnf("Datastore / disk conflict: %s newer than in the datastore", path)
} }
} }
...@@ -457,7 +459,7 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker, ...@@ -457,7 +459,7 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker,
} }
if updateDisk { if updateDisk {
logrus.Warn("updating bootstrap data on disk from datastore") logrus.Warn("Updating bootstrap data on disk from datastore")
return bootstrap.WriteToDiskFromStorage(files, crb) return bootstrap.WriteToDiskFromStorage(files, crb)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment