From 3cebde924b1bc5eedc0179e1461e43c5c0d5e6d4 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Thu, 17 Mar 2022 00:00:54 -0700 Subject: [PATCH] Handle empty entries in bootstrap path map Signed-off-by: Brad Davidson --- pkg/cluster/bootstrap.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/cluster/bootstrap.go b/pkg/cluster/bootstrap.go index 58fcdec5c9..39cf8c78ee 100644 --- a/pkg/cluster/bootstrap.go +++ b/pkg/cluster/bootstrap.go @@ -325,9 +325,11 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker, results := make(map[string]update) for pathKey, fileData := range files { path, ok := paths[pathKey] - if !ok { + if !ok || path == "" { + logrus.Warnf("Unable to lookup path to reconcile %s", pathKey) continue } + logrus.Debugf("Reconciling %s at '%s'", pathKey, path) f, err := os.Open(path) if err != nil { @@ -439,7 +441,7 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker, switch { case res.disk: updateDisk = true - logrus.Warn("datastore newer than " + path) + logrus.Warn("Datastore newer than " + path) case res.db: if c.config.ClusterReset { logrus.Infof("Cluster reset: replacing file on disk: " + path) @@ -448,7 +450,7 @@ func (c *Cluster) ReconcileBootstrapData(ctx context.Context, buf io.ReadSeeker, } newerOnDisk = append(newerOnDisk, path) 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, } 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) }