cvmfs-contrib/cvmfs-csi

volumeoptions.go defaults logic broken

Closed this issue · 1 comments

I came across this problem with a docker image built from the cvmfs-csi master branch code.

Hash and tag options are supposed to be optional, so I didn't set them. However I was getting
"missing required field tag" or "missing required field hash" errors.

I don't know go, but I think the problem is in the newVolumeOptions function. The call to validate, which sets a default for tag, needs to be moved up before the extractOption(tag) call

https://github.com/cernops/cvmfs-csi/blob/b39da4aed09e234bc6da7b1821b1bb8f341962c1/pkg/cvmfs/volumeoptions.go#L82

https://github.com/cernops/cvmfs-csi/blob/b39da4aed09e234bc6da7b1821b1bb8f341962c1/pkg/cvmfs/volumeoptions.go#L73

When setting both tag and hash, the error "specifying both hash and tag is not allowed" jumps, so the image is unusable.

gman0 commented

Hi @fbarreir, we are overhauling the driver in #39. The validation logic for volume parameters should be fixed there. Since the issue you're reporting won't be relevant anymore, I'm closing it. Please feel free to reopen, or open another one if you have comments or questions.