Skip to content

False "Firmware update is needed" on failed Bullseye installs #319

Open
@slowrunner

Description

When an update_gopigo3.sh install to Bullseye fails, the “check_if_firmware_upgrade_needed” will fail instantiating a GoPiGo3 because the setuptools was not present to install the gopigo3 egg files. When that instantiation fails because of the missing modules, the check executes the exception clause which improperly states “Firmware Upgrade Is Needed”

try:
        g = gopigo3.GoPiGo3()
        current_firmware = g.get_version_firmware()
        if current_firmware == available_firmware:
                print(f"\nThe GoPiGo is already running the latest firmare: {current_firmware}. \nAn upgrade is not needed at this time.\n")
                exit(1)
except Exception as e:
        print(e)
        print("Firmware upgrade is needed")
        exit(0)

While the end of the installation does give an error, many folks do not seem to read it.

GOPIGO3 SOFTWARE INSTALLATION FAILURE: +Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'gopigo3'
Suggest installing over Legacy Pi OS (Buster).

========
Suggestion for check_if_firmware_update_is_needed.py
move the firmware upgrade needed notice to an else clause:

...
 if current_firmware == available_firmware:
                print(f"\nThe GoPiGo is already running the latest firmware: {current_firmware}. \nAn upgrade is not needed at this time.\n")
                exit(1)
 else:
        # print("Firmware upgrade is needed")
        print(f"\nThe GoPiGo3 is running firmware: {current_firmware}.  An upgrade to {available_firmware} is needed.\n")
        exit(0)

except Exception as e:
        print(e)
        exit(0)

Activity

jharris1993

jharris1993 commented on Apr 24, 2022

@jharris1993
Contributor

Isn't zero a successful exit code?

Why does the successful exit, exit with a "1" and the errors exit with a "0"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      False "Firmware update is needed" on failed Bullseye installs · Issue #319 · DexterInd/GoPiGo3