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

receiptsmigration detection on windows is faulty if krew itself fails to install #374

Closed
ahmetb opened this issue Nov 10, 2019 · 3 comments · Fixed by #377
Closed

receiptsmigration detection on windows is faulty if krew itself fails to install #374

ahmetb opened this issue Nov 10, 2019 · 3 comments · Fixed by #377
Assignees
Labels
area/platform/windows Windows related issues priority/P2 P2 issues or PRs

Comments

@ahmetb
Copy link
Member

ahmetb commented Nov 10, 2019

If I try to install krew on windows and fail halfway and receipts/krew.yaml is not written, krew will end up in a situation that requires kubectl krew system receipts-upgrade.

This happens because we look at store/ dir which is not empty. But in this case of a bug (like #357) store/krew/ is actually an empty dir.

func Done(newPaths environment.Paths) (bool, error) {
receipts, err := ioutil.ReadDir(newPaths.InstallReceiptsPath())
if err != nil {
return false, err
}
store, err := ioutil.ReadDir(newPaths.InstallPath())
if err != nil {
return false, err
}
var hasInstalledPlugins bool
for _, entry := range store {
if entry.IsDir() {
hasInstalledPlugins = true
break
}
}
hasNoReceipts := len(receipts) == 0
return !(hasInstalledPlugins && hasNoReceipts), nil
}

What if we instead looked at entries under bin/ directory?

/area platform/windows
/priority P2

@ahmetb
Copy link
Member Author

ahmetb commented Nov 11, 2019

/assign @corneliusweig

@corneliusweig
Copy link
Contributor

Yes, that should indeed be more stable. Let's check if there is at least one symlink starting with kubectl-.

@ahmetb
Copy link
Member Author

ahmetb commented Nov 11, 2019

SGTM. That would ensure a plugin installed with krew exists (incl krew itself) so it would ensure krew is installed at least :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform/windows Windows related issues priority/P2 P2 issues or PRs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants