Skip to content
This repository has been archived by the owner on Jan 31, 2021. It is now read-only.

Commit

Permalink
Surface errors to web UI, ensure user has at least one SSH key
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Vittegleo committed May 30, 2017
1 parent 47f1bb5 commit 6c3fce5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dosxvpn

import (
"context"
"errors"
"fmt"
"time"

Expand Down Expand Up @@ -88,6 +89,9 @@ func Deploy(accessToken string, opts ...Option) (*Droplet, error) {
if err != nil {
return nil, err
}
if len(sshKeys) == 0 {
return nil, errors.New("Need at least one SSH key uploaded to your DigitalOcean account. Go add an SSH key: https://cloud.digitalocean.com/settings/security")
}
for _, key := range sshKeys {
keyToAdd := godo.DropletCreateSSHKey{ID: key.ID}
createRequest.SSHKeys = append(createRequest.SSHKeys, keyToAdd)
Expand Down
7 changes: 5 additions & 2 deletions static/progress_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ $(document).ready(function() {
}
$('#mobileconfig').css('display', 'block');
$('#exit').css('display', 'block')
updateProgressBar(100);;
updateProgressBar(100);
} else {
$('status-line').text('Install failed: ' + resp.status);
$('#status-line').text('Install failed: ' + resp.status);
updateProgressBar(0);
$('#initial-ip').text('');
$('#initial-ip').wrap('<a href="/"/>Retry Installation</a>');
return;
}

if (resp.status != 'done') {
Expand Down

0 comments on commit 6c3fce5

Please sign in to comment.