linode-cli icon indicating copy to clipboard operation
linode-cli copied to clipboard

[Bug]: "images upload" does not allow to specify filename

Open smemsh opened this issue 9 months ago • 5 comments

CLI Version

linode-cli v5.56.3 Built from spec version 4.193.0

Command

lin images upload --label mylabel --region us-ord \
    --cloud_init false --description mydesc \
    ~/my.img.gz

Output

linode-cli images upload: error: unrecognized arguments: /home/scott/my.img.gz

Expected Behavior

linode-cli should upload the given file specified as last argument.

Actual Behavior

Upload fails. If there is no filename, there is something "pending_upload" status, but I have no idea what file it's supposedly uploading.

I was able to use lin image-upload instead to get it to work, that does take a filename, although it's not listed in completions, only found it through https://techdocs.akamai.com/cloud-computing/docs/upload-an-image

However, while that did seem to upload, and the image was pending_upload for some time, it eventually disappeared with no trace, not shown in

lin images list --is_public false

Steps to Reproduce

No response

smemsh avatar Apr 06 '25 05:04 smemsh

Hi @smemsh, thanks for bringing this to our attention!

linode images upload command can only invoke the image upload API and give you a link to upload the image.

linode images upload --label mylabel --region us-ord \
    --cloud_init false --description mydesc
┌──────────────────┬──────────────────────────────────────────────────────────────────────────────────┬─────────────┬──────────────┬───────────────────┬─────────────────┬────────────┬────────────────┬────────────────────┬──────────────────┬────────────┐
│ image.id         │ upload_to                                                                        │ image.label │ image.vendor │ image.description │ image.is_public │ image.size │ image.status   │ image.capabilities │ image.total_size │ image.tags │
├──────────────────┼──────────────────────────────────────────────────────────────────────────────────┼─────────────┼──────────────┼───────────────────┼─────────────────┼────────────┼────────────────┼────────────────────┼──────────────────┼────────────┤
│ private/31226698 │ https://us-ord-1.linodeobjects.com/linode-production-machine-images-uploads/312… │ mylabel     │ None         │ mydesc            │ False           │ 0          │ pending_upload │                    │ 0                │            │
└──────────────────┴──────────────────────────────────────────────────────────────────────────────────┴─────────────┴──────────────┴───────────────────┴─────────────────┴────────────┴────────────────┴────────────────────┴──────────────────┴────────────┘

If you are looking for uploading the image file directly from CLI, you may use the image-upload CLI plugin:

linode image-upload --label mylabel2 --region us-ord --description mydesc2 ./my_image_file

Let us know if you have any other question.

zliang-akamai avatar Apr 07 '25 15:04 zliang-akamai

I see, there's a plugin to actually upload a file. It wasn't apparent that "linode images upload" would not be used to upload an image. Help does give a link to API documentation, which does describe the difference, so probably this is an RTFM, but it would be good if the CLI help said something about the separate command to actually perform an upload.

Since that plugin comes with the standard install anyways, I would suggest triggering it if a last argument is supplied for "linode images upload", that way there's only one invocation interface and no need for a separate "image-upload" command.

smemsh avatar Apr 07 '25 19:04 smemsh

P.S. my upload using "image-upload" failed: it seemed to succeed (progress and completion), but then it was pending for a while, and finally just disappeared. No idea what happened to the upload or any reason for it being invalid if that's why it disappeared. I might suggest the plugin blocks after the upload in a poll loop and then exiting with some status if it disappears, or once the status becomes ready. If there's a way of knowing if/why rejected it would be good.

smemsh avatar Apr 07 '25 19:04 smemsh

Yeah, the plugin doesn't seem to work. Upload succeeds after 100% progress, shows as id: private/31233398, is_public: false and status: pending_upload. Try listing again in ten minutes, and no images exist anymore with is_public: false. Somehow it disappeared.

I had to give a different region (us-ord) than my default (us-west), and upon upload completion, the "regions" table displayed by the plugin shows region/status columns, but the table has no rows, this might have something to do with the disappearance.

smemsh avatar Apr 07 '25 23:04 smemsh

I see in the web console that the image was rejected due to being too large. That should be shown in the upload status, rather than the upload vanishing. But note that events are visible from the CLI, so the error could be read from there, but no way to know this without guessing to check it.

smemsh avatar Apr 08 '25 01:04 smemsh

I looked into a docs PR in linode/linode-api-docs but apparently that's auto-generated and the repo is private so I have given up pursuing this. Thanks for the info at least it's documented here.

smemsh avatar Aug 28 '25 15:08 smemsh