-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Added OAuth to provisioner stop method #365
Conversation
@@ -104,8 +105,13 @@ class Provisioner { | |||
* @param {String} name of VM to create | |||
* @return {Promise.<Object>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's quickly describe the format of the return type while we're at it...is it just:
{
droplet: <droplet id, as a string>
}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the return type to Promise since there isn't anything to return.
Sorry for the delay! |
I updated provisioner.ts to separate the |
* @return {Promise.<void>} | ||
*/ | ||
private destroyServer_ = (name: string): Promise<void> => { | ||
if (this.state_.oauth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than wrapping the whole function in a try/catch block you could make this a precondition-like block:
if (!this.state_.oauth) {
return Promise.reject({
'errcode': 'OAUTH_ERR',
'message': 'Cannot destroy server - not logged into digital ocean'
});
...
...
}
Actually...since this is a private method only called by stop
, do you really need this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that we don't need it. Made this change.
BTW, am investigating the Travis failures now... |
👍 |
This change is