Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad index file - timing issue #101

Open
MikaelElkiaer opened this issue Nov 24, 2023 · 2 comments
Open

Bad index file - timing issue #101

MikaelElkiaer opened this issue Nov 24, 2023 · 2 comments

Comments

@MikaelElkiaer
Copy link

Hi, love this tool and use it every day!

After adding a Vault KV2 store, I've started to sporadically seeing the following error:

$ switch
Error: could not unmarshal index file with path '/home/me/.kube/switch-state/switch.filesystem.default.index': yaml: line 5: could not find expected ':'
could not unmarshal index file with path '/home/me/.kube/switch-state/switch.filesystem.default.index': yaml: line 5: could not find expected ':'

It usually will occur after aborting a switch.
Below is an example - the Error: abort is caused by a <C-c> or <esc> key press.
After which I will just remove /home/me/.kube/switch-state/switch.filesystem.default.index and it will work again for some time.

$ cat ~/.kube/switch-state/switch.filesystem.default.index
kind: filesystem
contextToPathMapping:
  output/default: /home/me/Repositories/GitHub/org/helm-charts/charts/project/.debug/output/kubeconfig.yaml
$ switch
Error: abort
abort
$ switch
Error: could not unmarshal index file with path '/home/me/.kube/switch-state/switch.filesystem.default.index': yaml: line 5: could not find expected ':'
could not unmarshal index file with path '/home/me/.kube/switch-state/switch.filesystem.default.index': yaml: line 5: could not find expected ':'
$ cat ~/.kube/switch-state/switch.filesystem.default.index
kind: filesystem
contextToPathMapping:
  .kube/minikube: /home/me/.kube/config_minikube
rg/helm-charts/charts/project/.debug/output/kubeconfig.yaml
@danielfoehrKn
Copy link
Owner

Hi, thanks for reporting. I think that requires either some fallback logic to repair the index file or a signal handler for SIGTERM in the switcher binary that makes sure that the process only terminates after existing filesystem write operations are completed.

@needleshaped
Copy link

Workaround for me was rm -rf ~/.kube/switch-state/, s clean did not help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants