weaveworks-experiments / compare-revisions

Experimental thing for comparing what's on k8s clusters
Apache License 2.0
0 stars 0 forks source link

Fix crash on config repo update #25

Closed jml closed 7 years ago

jml commented 7 years ago

We were getting crashes on config repo update, due to swapSymlink returning a relative path that we then passed to removeDirectoryRecursive.

We should not have got to removeDirectoryRecursive at all, but the check unlessM (fileExist path) action means "do action unless path exists", i.e. "only do action if path doesn't exist". That is, I got my booleans backwards. Oops.

I've replaced that check with something that just removes the directory regardless and catches the "doesn't exist" exception. This has the benefit of being more correct.

Also wrote some tests, since the file-on-disk stuff is quite statey.

I'll merge this tomorrow unless someone reviews before then.