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

humility flash could have an idempotent mode #410

Open
jclulow opened this issue Jul 27, 2023 · 0 comments
Open

humility flash could have an idempotent mode #410

jclulow opened this issue Jul 27, 2023 · 0 comments

Comments

@jclulow
Copy link
Contributor

jclulow commented Jul 27, 2023

As noted in #408, during manufacturing we are doing something suboptimal:

if ! humility flash --check; then
        printf 'contents incorrect; programming...\n'
        if ! humility flash --verify; then
                printf 'programming failed!\n'
                exit 1
        fi
fi
printf 'ok\n'

In the event that the flash contents are already correct, flash --check will return success and we drive on.

In the event that the flash contents are not already correct, the check fails and we move on to flash --verify which then performs the same check again before eventually programming.

The reason we use this sequenced is that (as far as I can tell) flash --verify, like flash, will fail execution if the flash contents is already correct and we didn't have to do any work. This strict execution makes sense under some conditions; I can definitely imagine cases where I believed I was replacing the flash contents with something new, but it turns out I was mistaken. For manufacturing, though, what we really want is:

if ! humility flash --idempotent; then
        printf 'problems!\n'
        exit 1
fi

This would still include all of the checks that --check and --verify already perform today (i.e., the flash contents, not just the image ID, are verified) but it would exit successfully after the initial check if the contents are already as they should be.

If we don't want to use --idempotent, then perhaps a verb like --ensure would also capture the intent.

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

1 participant