Feature/better ota upgrade - #154
Conversation
Tool had partial support to update devices using diffs of a different application id. Formally extended support for cross-application upgrades by: * Disabling using cross-app diff by default, and enabling with cli arg. * When enabled, allowing devices with a different app-id to be upgraded using a diff from a different app-id Usage: add `--cross-app` to `ota_upgrade.py --cross-app -r ...` to allow devices running a different app to be upgraded. Notes: * `--cross-app` is not required when the diff selected by `--single` is already for a different application id. * As a result, it has no effect when used with `--single`. * Requires a diff to be already generated for the release. This does not create one.
Improved patch upload failure error handing. When uploading a patch fails, prints out an error message. e.g. when using `--single`, if the gateway and upgrade target are on different networks, The RPC fails with `-EIO`. The generic error is now printed to the console.
Decoupled update logic from main run loop. This will allow the update loop to be run on multiple threads. Signed-off-by: Aeyohan Furtado <aeyohan@embeint.com>
Update relevant functions to manually specify which `LocalClient` is being used. This will allow relevant functions to be called to a specific gateway client. Signed-off-by: Aeyohan Furtado <aeyohan@embeint.com>
Updated multiple state variables to accommodate handling multi-device state. Moved connection, copying and uploading to their own state variables. Updated table UI to use new state variables. Updated UI redraws to not depend on state change. Signed-off-by: Aeyohan Furtado <aeyohan@embeint.com>
Enable mutliple gateway server ports. Each gateway is handled by a separate thread. UI can handle displaying status on multiple gateways. Signed-off-by: Aeyohan Furtado <aeyohan@embeint.com>
786bc3a to
5928476
Compare
|
fix multi line fstring for CI |
JordanYates
left a comment
There was a problem hiding this comment.
Can you remove the first commit from this PR as well, it could come in later with extra checks, but its pretty dangerous in a development context, which is where this script runs.
If you have cross-app diffs, you probably have a few devices running said apps for testing purposes. The option will automatically force them all to the same app, which is not necessarily what you want.
| except RuntimeError as e: | ||
| sys.exit(str(e)) | ||
| for client in unavailable: | ||
| self._clients.remove(client) |
There was a problem hiding this comment.
This is being done in a few places, it should be done once after the print output at the start of the function
| meta.add_column() | ||
| meta.add_row(table) | ||
| meta.add_row(Status(self.state)) | ||
| if self._state_connecting: |
There was a problem hiding this comment.
Instead of this, I think it makes more sense to roll the state for each GW into a line:
status = Table.grid(expand=True)
status.add_column()
status.add_column()
status.add_column(ratio=1)
for gw in gateways:
status.add_row("GW ADDR ", Status(self.state), self.progress)
meta = Table.grid()
meta.add_row(table)
meta.add_row(status)
return meta
There was a problem hiding this comment.
Does GW_ADDR, refer to the socket port?
Otherwise if this is for the gateway's Infuse ID, I initially did think of something like this, but I don't know how to easily get it though?
There was a problem hiding this comment.
The socket address/port, maybe in the form 224.1.1.1:5791? If it looks confusing maybe just the port
| try: | ||
| self._state_uploading.add(source.infuse_id) | ||
| live.update(self.progress_table()) | ||
| # self.state_update(live, f"Uploading patch file to {source.infuse_id:016X}") |
Even though it's locked behind needing to specify |
Yes, I am thinking an explicit warning through the
It makes sense to keep (probably with a similar warning as above), but its related to cross-app, so belongs in the same PR as that option PR. |
A few different OTA upgrade improvements:
--singleand normal releases). Disabled by default, and opt in with--cross-app--server-port (port1) (port2) (...)Tested with
--singleand-roptions (incidentally using--cross-appsince the only tags I could easily use weren't downgrading (presumably rollback protection) so cross app was easier to go between.sample:
