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

Failed image download not recognized #83

Open
kb2ma opened this issue Jul 1, 2024 · 0 comments
Open

Failed image download not recognized #83

kb2ma opened this issue Jul 1, 2024 · 0 comments

Comments

@kb2ma
Copy link
Contributor

kb2ma commented Jul 1, 2024

The code to download an OS image does not verify that an image actually is returned. In the example below, the result status is 404. Should at least verify the result status is 2xx. Maybe also display the response body. In the case below it was "Error downloading application image".

$ ./takeover -d -c config.json --version 5.3.4+rev3 --log-level debug
...
17:08:52 INFO  Downloading Balena OS image, selected version is: '5.3.4+rev3'
17:08:53 DEBUG [reqwest::connect] starting new connection: https://api.balena-cloud.com/
17:08:53 DEBUG [takeover::stage1::api_calls] dt_contract_request Result = Response { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("api.balena-cloud.com")), port: None, path: "/v6/device_type", query: Some("$orderby=name%20asc&$top=1&$select=contract&$filter=device_type_alias/any(dta:dta/is_referenced_by__alias%20eq%20%27beaglebone-black%27)"), fragment: None }, status: 200, headers: {"date": "Sun, 30 Jun 2024 17:08:53 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "cache-control": "no-cache", "etag": "W/\"2a39-f9gfLUhNzd0N0jGbXz/ID/w/inE\"", "vary": "Accept-Encoding", "cf-cache-status": "DYNAMIC", "strict-transport-security": "max-age=15552000", "server": "cloudflare", "cf-ray": "89bfc2c86cc2904b-BOS", "alt-svc": "h3=\":443\"; ma=86400"} }
17:08:53 DEBUG [takeover::stage1::api_calls] Device contract for beaglebone-black is DeviceTypeContractInfo { contract: Contract { data: ContractData { media: Media { alt_boot: Some(["sdcard"]), default_boot: "internal" }, flash_protocol: None } } }
17:08:53 DEBUG [takeover::stage1::api_calls] Downloading raw image for device type beaglebone-black
17:08:53 DEBUG [takeover::stage1::api_calls] get_os_image: request_url: 'https://api.balena-cloud.com/download'
17:08:53 DEBUG [takeover::stage1::api_calls] get_os_image: data: 'ImageRequestData { device_type: "beaglebone-black", version: "5.3.4+rev3", file_type: ".gz", image_type: Some("raw") }'
17:08:53 DEBUG [reqwest::connect] starting new connection: https://api.balena-cloud.com/
17:08:53 DEBUG [takeover::stage1::api_calls] Result = Response { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("api.balena-cloud.com")), port: None, path: "/download", query: None, fragment: None }, status: 404, headers: {"date": "Sun, 30 Jun 2024 17:08:53 GMT", "content-type": "application/json; charset=utf-8", "content-length": "37", "connection": "keep-alive", "vary": "X-HTTP-Method-Override, Accept-Encoding", "etag": "W/\"25-myxgCtuBvOanXmid4jQRrGznqms\"", "cf-cache-status": "DYNAMIC", "strict-transport-security": "max-age=15552000", "server": "cloudflare", "cf-ray": "89bfc2ca88338f6d-BOS", "alt-svc": "h3=\":443\"; ma=86400"} }
17:08:53 DEBUG [takeover::stage1::image_retrieval] Downloading file '/home/debian/migrate/balena-cloud-beaglebone-black-5.3.4+rev3.img.gz'
17:08:53 INFO  37 B read in 0 seconds @37 B/sec 
17:08:53 INFO  The balena OS image was successfully written to '/home/debian/migrate/balena-cloud-beaglebone-black-5.3.4+rev3.img.gz'
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