Skip to content

Usage of go-rocket-update #42

@mouuff

Description

@mouuff

Hello,

While you are using updater.Update() you are checking if the status is UpToDate only if an error have been returned:

verbis/api/sys/update.go

Lines 62 to 74 in 1e2191c

code, err := s.client.Update()
if err != nil {
logger.Error("Executable updated failed, rolling back")
err := s.client.Rollback()
if err != nil {
logger.Panic(err)
}
switch code {
case rocket.UpToDate:
return "", &errors.Error{Code: errors.INVALID, Message: "Verbis is up to date", Operation: op, Err: err}
default:
return "", &errors.Error{Code: errors.INTERNAL, Message: "Error updating Verbis with status code: " + strconv.Itoa(int(code)), Operation: op, Err: err}
}

This will never happen because if the application is UpToDate then the updater will not return any error.
An error will only be returned when something bad happens, (for example: you are offline and cannot check for an update)

Also, you don't need to call Rollback() yourself, unless you want to rollback after successful update. (for example if you are doing an additional check by yourself to see if it is installed correctly)

The project is smart enough to rollback by itself if something bad happens during the installation :)

I hope you like the go-rocket-update project.
Don't hesitate to reach out. I will try to support everyone who is trying to adopt this library :)

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions