Page MenuHomeVyOS Platform

HTTPS API image cannot be updated
Closed, ResolvedPublicBUG

Description

Cannot update system image via API

set service https api keys id KID key 'foo'
set service https api socket

Check that API works:

vyos@r1:~$ curl -k --location --request POST 'https://192.168.122.11/show' \
> --form data='{"op": "show", "path": ["system", "image"]}' \
> --form key='foo'
{"success": true, "data": "The system currently has the following image(s) installed:\n\n   1: 1.4-rolling-202311020707 (default boot) (running image)\n   2: 1.3.4\n   3: 1.3.3\n\n", "error": null}

Update image:

vyos@r1:~$ curl -k --location  --request POST 'https://192.168.122.11/image' \
>   --form data='{"op": "add", "url": "http://192.168.122.11:8000/vyos-1.4-rolling-202311090309-amd64.iso"}' \
>    --form key='foo'
{"success": false, "error": "Trying to fetch ISO file from http://192.168.122.11:8000/vyos-1.4-rolling-202311090309-amd64.iso...\nDownloading...\nThe file is 439.000 MiB.\ntput: No value for $TERM and no -T specified\nUnable to download \"http://192.168.122.11:8000/vyos-1.4-rolling-202311090309-amd64.iso\": [Errno 25] Inappropriate ioctl for device\nDownload complete.\npre-3\nDone.\nChecking for digital signature file...\nDownloading...\nUnable to download \"http://192.168.122.11:8000/vyos-1.4-rolling-202311090309-amd64.iso.minisig\": 404 Client Error: File not found for url: http://192.168.122.11:8000/vyos-1.4-rolling-202311090309-amd64.iso.minisig\nDownload complete.\npre-3\nChecking digital signature...\nDigital signature is valid.\n\"/var/tmp/install-image.4591/vyos-1.4-rolling-202311090309-amd64.iso\" is not a valid ISO image file.\nExiting...\n", "data": null}

Note works fine in 1.3.4

Details

Version
VyOS 1.4-rolling-202311020707
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

jestabro triaged this task as Urgent! priority.
jestabro added a subscriber: erkin.

Changing this https://github.com/vyos/vyos-1x/blob/2e587c8329a1d32fc1ec601c7753211d0fedbf2c/python/vyos/remote.py#L356
to

download(local_path, urlstring, False, True, source_host, source_port)

Fixes the issue for API

i.e

sudo sed -i 's/download(local_path, urlstring, True/download(local_path, urlstring, False/' /usr/lib/python3/dist-packages/vyos/remote.py
curl -k --location  --request POST 'https://192.168.122.14/image'    --form data='{"op": "add", "url": "http://192.168.122.14:8000/vyos-1.5-rolling-202311120024-amd64.iso"}'     --form key='foo'
{"success": true, "data": "Trying to fetch ISO file from http://192.168.122.14:8000/vyos-1.5-rolling-202311120024-amd64.iso...\nDownloading...\nThe file is 420.000 MiB.\nDownload complete.\npre-3\nDone.\nChecking for digital signature file...\nDownloading...\nUnable to download \"http://192.168.122.14:8000/vyos-1.5-rolling-202311120024-amd64.iso.minisig\": 404 Client Error: File not found for url: http://192.168.122.14:8000/vyos-1.5-rolling-202311120024-amd64.iso.minisig\nDownload complete.\npre-3\nChecking digital signature...\nDigital signature is valid.\nChecking SHA256 checksums of files on the ISO image... OK.\nDone!\nWhat would you like to name this image? [1.5-rolling-202311120024]: OK.  This image will be named: 1.5-rolling-202311120024\nInstalling \"1.5-rolling-202311120024\" image.\nCopying new release files...\nWould you like to save the current configuration \ndirectory and config file? (Yes/No) [Yes]: Copying current configuration...\nWould you like to save the SSH host keys from your \ncurrent configuration? (Yes/No) [Yes]: Copying SSH keys...\nRunning post-install script...\nSetting up grub configuration...\nDone.\n", "error": null}

The same bug we have for ansible

Viacheslav changed the task status from Open to Needs testing.Nov 15 2023, 4:09 PM
Viacheslav moved this task from Open to Finished on the VyOS 1.4 Sagitta board.