-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Droplet State Checks #31
Conversation
Realized I don't give a concrete example above. Here's one:
|
I like it! It saves us from making an unnecessary API call and therefore reduces the time before tugboat exits. Since we get the status information for free in
|
Yea, that state wording is a little confusing isn't it. I'm going to correct that. For |
LGTM. Good point about restart, and I agree. Since DigitalOcean will start a stopped droplet here, we should probably not override that behaviour. |
Ok, cool. I'm convinced. Merging! |
The addition of #30 made me think of this.
Basically, during FindDroplet, we already retrieve the details of a droplet. This includes the Droplet's "status". For example, if a Droplet is shutdown it's status is
off
.So, we know that some commands require certain state before working properly.
I added several middleware's:
CheckDropletInactive
andCheckDropletActive
. This simply looks at thedroplet_status
injected duringFindDroplet
, and if it's not active/inactive, raises an error to the user.This might be overkill and too hand-holdy. I can't really decide, but I thought I would write it anyway to show what it's like. I'm personally a bit on the fence about including it.