platformsh / legacy-cli

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli
https://docs.platform.sh/administration/cli.html
MIT License
224 stars 121 forks source link

`platform environment:resume` returns an error if the project is not paused #1332

Open rfay opened 9 months ago

rfay commented 9 months ago

platform environment:resume returns an error if the project is not paused.

It doesn't seem like this should be an error. How about a success return value?

$ platform environment:resume --project="${PLATFORM_PROJECT}" --environment="${PLATFORM_ENVIRONMENT}" --yes
The environment platform-pull (type: staging) is not paused. Only paused environments can be resumed.
l$ echo $?
1
Platform.sh CLI 4.10.2
pjcdawkins commented 7 months ago

I guess the status not being "paused" doesn't necessarily mean that it is active or has been successfully resumed - because there is an in-between status of "dirty" while an environment might be either on the way to being paused, or on the way to being resumed. And there are also the statuses of "inactive" and "deleting" which would also not be desired results of resuming. So I feel returning an error feels more conservative: it's up to the caller then to check the exact environment state. I suppose we could return 0 if the environment is active, and 1 otherwise? but that seems convoluted.