balena-io-modules / balena-preload

Script for preloading containers onto balena device images
https://www.balena.io/
Apache License 2.0
35 stars 8 forks source link

Should avoid using any device-type.json fields in preload #265

Open klutchell opened 2 years ago

klutchell commented 2 years ago

We should find a better way to detect if the image is a flasher type or not, without an API query.

pdcastro commented 2 years ago

without an API query

For what it is worth, specifically with regard to the deprecation of the balena SDK's models.config.getDeviceTypes() method and the /device-types/v1 API endpoint, we could still make use of the SDK / API to obtain device type information, just using different SDK methods / different API endpoints. For example:

thgreasi commented 2 years ago

@klutchell WRT device_type["yocto"]["deployArtifact"] in the python script, it looks like it's predictable to some degree. The pattern of options that I see is: (balena|resin)-image-flasher-(<slug>|<alias>.(balenaos|resinos)-img

Could we potentially search in the FS for whether any of the options actually exists?

https://github.com/balena-io-modules/balena-preload/blob/f1c791c1c8590f4fd812552fd5088975f653e758/src/preload.py#L716-L717

klutchell commented 2 years ago

Could we potentially search in the FS for whether any of the options actually exists

@thgreasi Yeah, the names are predictable so this is what I thought of as well.