puppetlabs-toy-chest / wash

Wide Area SHell: a cloud-native shell for bringing remote infrastructure to your terminal.
https://puppetlabs.github.io/wash
Apache License 2.0
180 stars 29 forks source link

Clearing cache on a volume doesn't clear the source #770

Closed MikaelSmith closed 4 years ago

MikaelSmith commented 4 years ago

Setup is to run a Docker container and use Wash to navigate to some point in its filesystem. Depending on where you are, running wclear . doesn't actually clear cached data. whistory output is the clearest way to demonstrate that.

wash docker/containers/strange_fermat/fs/usr/local > wclear .
wash docker/containers/strange_fermat/fs/usr/local > whistory 1
Apr 14 16:24:36.627 API: DELETE /cache?path=%2FUsers%2Fmichaelsmith%2FLibrary%2FCaches%2Fwash%2Fmnt167843624%2Fdocker%2Fcontainers%2Fstrange_fermat%2Ffs%2Fusr%2Flocal
Apr 14 16:24:36.627 API: Cache DELETE /docker/containers/strange_fermat/fs/usr/local []
Apr 14 16:24:36.627 API: DELETE /cache?path=%2FUsers%2Fmichaelsmith%2FLibrary%2FCaches%2Fwash%2Fmnt167843624%2Fdocker%2Fcontainers%2Fstrange_fermat%2Ffs%2Fusr%2Flocal complete

The 2nd line of output shows nothing was deleted from the cache.

wash docker/containers/strange_fermat/fs/usr/local > wclear ..
wash docker/containers/strange_fermat/fs/usr/local > whistory 2
Apr 14 16:24:48.079 API: DELETE /cache?path=%2FUsers%2Fmichaelsmith%2FLibrary%2FCaches%2Fwash%2Fmnt167843624%2Fdocker%2Fcontainers%2Fstrange_fermat%2Ffs%2Fusr
Apr 14 16:24:48.079 API: Cache DELETE /docker/containers/strange_fermat/fs/usr [List::/docker/containers/strange_fermat/fs]
Apr 14 16:24:48.079 API: DELETE /cache?path=%2FUsers%2Fmichaelsmith%2FLibrary%2FCaches%2Fwash%2Fmnt167843624%2Fdocker%2Fcontainers%2Fstrange_fermat%2Ffs%2Fusr complete

Running the same thing against the parent directory, the fs entry is deleted from the cache.

This appears to happen because wclear clears any cache items related to the entry and its parent. However the fs/usr/local entry itself is derived from the fs entry and there are no actual cache entries that contain it or its parent.