UpCloudLtd / upcloud-cli

UpCloud command line client (upctl)
https://upcloudltd.github.io/upcloud-cli/
MIT License
29 stars 7 forks source link

Please add a subcommand to `upctl storage` to wait for a given storage to be online #174

Closed nogweii closed 2 years ago

nogweii commented 2 years ago

Is your feature request related to a problem? Please describe. I'm trying to automate the process of uploading a raw Arch Linux disk image (from their arch-boxes project) and each step needs the storage to be online. I had to write my own loop around that, and would appreciate the CLI providing that power for me.

Describe the solution you'd like An additional subcommand called "wait" or similar that can take a UUID (and/or title?) and will block until the storage resource is in an online state, ready to be used.

Describe alternatives you've considered I have to write a while loop in each of my scripts wrapping upctl. Not that I have many, though.

Additional context I built some automation around upctl to do what I wanted, but it would be nice if that could have been easier. You can see a copy of my code in this gist;

Specifically, I'd like to call out the following lines:

https://gist.github.com/nogweii/0d9afa8246525d21eaf71ad2d12ae955#file-upload_to_upcloud-sh-L22-L29

kangasta commented 2 years ago

Hi, thanks for the improvement idea!

We currently have similar behavior for server create and stop commands implemented with --wait flag, e.g. upctl server stop --wait $server-name.

Following the same pattern, we could add --wait flag to upctl storage import as well. The command would then block until storage is online if --wait flag was given. This would work at least in the gist you provided, right?

nogweii commented 2 years ago

Yep, along with the same flag being available for upctl storage templatise as well. Add the flag to both would satisfy my use case.