balena-os / takeover

Migrate arbitrary devices to balena
12 stars 8 forks source link

Check earlier for log device #78

Closed lmbarros closed 5 months ago

lmbarros commented 5 months ago

Previously, we'd check for the log device (passed with --log-to) only after the user confirmed to proceed with the migration. And then, if the device was not valid, takeover would keep running without storing the stage 2 logs anywhere.

In other words, a mistake in the command-line arguments could cause important logs to be lost.

With this commit, we check the the log device at a much earlier point (before asking the user for confirmation to proceed), and if the device provided is no good, we log an error message and exit. This allows the user to fix the command-line arguments and run again.