Skip logic if service does not exist#379
Conversation
eloisejones
left a comment
There was a problem hiding this comment.
LGTM, but I'm not offended if you wait for Alex :)
|
I'm going to join as an author (and duck out as reviewer) since I feel strongly about the solution, and Michael is OOO today. I changed this from returning an empty result, to tell the customer the database isn't provisition. This is the same as the existing behavior for these commands in this scenario if the database is not properly provisioned with a sevice (either because it it's provisioned, failed to provision, deprovisioning, or failed to deprovision:
|
eloisejones
left a comment
There was a problem hiding this comment.
One comment, otherwise lgtm. Thanks, Alex!
| klass = resource.class | ||
|
|
||
| if klass == Aptible::Api::App | ||
| # We could also raise the error here, but it would technically be a |
There was a problem hiding this comment.
Is it worth adding a test specifically for this case, if that's the behavior we expect? I didn't see a block for that case, but might have missed it.
There was a problem hiding this comment.
I didn't change anything about how commands for interacting with App endpoints worked here, and I didn't check for tests for that behavior but it probably doesn't exist because this is a nonsense/edge case:
EG, today: you can try to list endpoints for an app that has never been provisioned, and you just get an empty list back:
[~]$ aptible apps:create demo
App demo created!
[~]$ aptible endpoints:list --app demo
[~]$
What did you expect to get? The app is in a state where it's not possible to have endpoints, and any attempt to create or list isn't possible.
I'd argue this is better, and it's what i mentioned/showed in the comment (but didnt implement because it's technically a breaking change):
[~]$ aptible apps:create demo
App demo created!
[~]$ aptible endpoints:list --app demo
App is not provisioned
[~]$
If a service doesn't exist, attempting to list vhosts for said service errors out.
Skip attempting to list/find vhosts for services that don't exist in
endpoint:list.