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

add a special message for failing to install the current version #916

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion ffi/updatedownload.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ func UpdateDownloadFromAirgap(socket, fromArchivePath, namespace, registryJson,
return
}

if !bc.Before(ac) {
if bc.Equal(ac) {
err := errors.Errorf("Version %s (%s) cannot be installed again because it is already the current version", afterInstallation.Spec.VersionLabel, afterCursor.Cursor)
fmt.Printf("%s\n", err.Error())
ffiResult = NewFFIResult(-1).WithError(err)
return
} else if bc.After(ac) {
err := errors.Errorf("Version %s (%s) cannot be installed because version %s (%s) is newer", afterInstallation.Spec.VersionLabel, afterCursor.Cursor, beforeInstallation.Spec.VersionLabel, beforeCursor.Cursor)
fmt.Printf("%s\n", err.Error())
ffiResult = NewFFIResult(-1).WithError(err)
Expand Down
4 changes: 3 additions & 1 deletion kotsadm/pkg/airgap/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ func UpdateAppFromAirgap(a *app.App, airgapBundle multipart.File) (finalError er
return errors.Errorf("cannot compare %q and %q", beforeKotsKinds.Installation.Spec.UpdateCursor, afterKotsKinds.Installation.Spec.UpdateCursor)
}

if !bc.Before(ac) {
if bc.Equal(ac) {
return errors.Errorf("Version %s (%s) cannot be installed again because it is already the current version", afterKotsKinds.Installation.Spec.VersionLabel, afterKotsKinds.Installation.Spec.UpdateCursor)
} else if bc.After(ac) {
return errors.Errorf("Version %s (%s) cannot be installed because version %s (%s) is newer", afterKotsKinds.Installation.Spec.VersionLabel, afterKotsKinds.Installation.Spec.UpdateCursor, beforeKotsKinds.Installation.Spec.VersionLabel, beforeKotsKinds.Installation.Spec.UpdateCursor)
}

Expand Down