Coder Social home page Coder Social logo

digitalocean / doctl Goto Github PK

View Code? Open in Web Editor NEW
3.2K 132.0 377.0 56.04 MB

The official command line interface for the DigitalOcean API.

Home Page: https://docs.digitalocean.com/reference/doctl/

License: Apache License 2.0

Go 99.11% Shell 0.59% Makefile 0.27% Dockerfile 0.03%
command-line digitalocean infrastructure hacktoberfest cloud

doctl's Issues

SSH Client doesn't work on Windows

It happens on current master (a57555c), when trying to connect to a droplet from Windows 10 in VirtualBox.

There are 2 different problems:

1/ When trying to connect with a SSH key that isn't password protected, the error is:

doctl.exe compute ssh playground --ssh-key-path D:\ssh-tmp-keys\id_rsa_without_password
Error: read /dev/stdout: The handle is invalid.

The problem is that this line is using os.Stdout while it should be using os.Stdin.

There's also a logical error here, we check for the function scoped err before starting the shell, but it can be non-nil because of this line.

2/ When trying to connect with a SSH key that is password protected, the error is:

doctl.exe compute ssh playground --ssh-key-path D:\ssh-tmp-keys\id_rsa_with_password
Error: asn1: structure error: tags don't match (16 vs {class:1 tag:6 length:50 isCompound:false}) {optional:false explicit:false application:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} pkcs1PrivateKey @2

The problem is that ssh.ParsePrivateKey(key) on this line expects a PEM encoded private key so we have to decrypt it first.

The SSH keys used to reproduce this issue have been generated using:
ssh-keygen -t rsa -b 4096 -C "[email protected]"

One key has a passphrase, the other doesn't. They are attached here:
ssh-test-keys.tar.gz

doctl didn't create $HOME/.doctlcfg file

No sure why, but ran the following command after installing doctl using Homebrew (Mac OS, El Capitan, v10.11.5).

doctl auth login -t (my token)

Output: updated access token

But no .doctlcfg file was created in $HOME.

Add a FreeBSD release

I would like to make a FreeBSD port for the doctl tool.

It would be much easier to pull the release build from github rather than building it from source.

Would it be possible to add a FreeBSD release?

Plesee describe in README.md more detail about compile from source

Alternatively, if you have a Go environment configured, you can install the development
version of doctl from the command line like so:
go get github.com/digitalocean/doctl

I type doctl after this and have no success. I will doing additional shell steps?
Please clarify you REAMDE.md with this steps.

Thanx.

--ssh-port option ignored

My droplets use a non-standard port for ssh. So I tried this:
doctl compute ssh <my_droplet> --ssh-user <my_user> --ssh-port 1234

But I get ssh: connect to host <droplet_ip> port 22: Connection refused
Error: 255

Software Version
doctl v1.0.0
OS OSX El Capitan 10.11.4 (15E65)
Shell iTerm 2 (2.1.4)

Btw, thank you all for this awesome tool!!

[Suggestion] notify/callback option when --wait omitted

This is probably not specific for doctl itself, but also the API.
I think it could be useful if you start creating a droplet, and don't want to wait until it's finished, if you could have it notify you by e-mail once it's done creating, or maybe a callback URL?

I'm part of a new startup company located in Denmark, where we're already using Digital Ocean for some of our servers, we do plan to use this for our customers also, although (would be sweet with a Digital Ocean presence in Denmark :)) and as part of a more or less automated deployment is where I think a callback URL option could be useful, it would probably be required to implement this into the API also.

Tag droplet returns 404 error

Running the command:
doctl compute droplet tag <droplet-name or droplet-id> --tag-name mytag

returns the error message:
Error: POST https://api.digitalocean.com/v2/tags/testing/resources: 404 The resource you were accessing could not be found.

support for inline repl/shell?

Would it be possible to have something equivalent to a shell for this tool? I find myself typing doctl compute droplet <action> a lot, and it'd be nice if I could do something like cd compute/droplet or cd compute and then just droplet <action> or droplet-action <action> directly.

doctl should support a config file

Currently the doctl command line tool supports retrieving auth from env vars, but I would prefer to store these in a dot file in my home directory.

Ephemeral Access Token

After authenticating using: doctl auth login --access-token {string}

The doctl auth login doesn't' work.

you still get:

Error: access token is required

when trying to run doctl compute droplet list or most of the commands.

To list, you have to use:

doctl compute droplet list --region nyc3 --output json --access-token

That's not ideal if you have to use the token each time.

Installed via Homebrew

Replace `doctl auth login` with `doctl auth init`

The doctl auth login process has a few issues that doesn't allow it to work the same way on every platform. I'm proposing we replace this with a doctl auth init that will take a DO token on the command line and do the initial configuration which will include creating a doctl config file.

`doctl compute images list` does not include slug.

[~]# doctl compute image list
ID      Name                            Type        Distribution    Slug        Public  Min Disk
79909       Rails-3.2.12-Nginx-MySQL                snapshot    Ubuntu              false   20
13271590    FreeBSD 10.2 Raw                    snapshot    FreeBSD             false   20
15836396    packer-1455685225                   snapshot    Ubuntu              false   40
15836558    packer-1455685874                   snapshot    Ubuntu              false   40
15836632    packer-1455686129                   snapshot    Ubuntu              false   40
308121      WordPress on Ubuntu 12.10               snapshot    Ubuntu              false   20
385625      WordPress on Ubuntu 12.10               snapshot    Ubuntu              false   20
415651      WordPress on Ubuntu 12.10               snapshot    Ubuntu              false   20


Add template support to customize outputs

Using Go templates, expose the raw response to the end user, so outputs can be customized. As an example, if you retrieve a droplet with doctl compute droplet get 1234, you could retrieve the droplet creation time with `doctl compute droplet get 1234 --template ".CreatedAt".

plain "go get" doesn't work on the repository

$ go get github.com/digitalocean/doctl/cmd/doctl doesn't work out of the box:

$ go get github.com/digitalocean/doctl/cmd/doctl
# cd /home/user/mygo/src/github.com/digitalocean/doctl; git submodule update --init --recursive
fatal: no submodule mapping found in .gitmodules for path 'vendor/github.com/inconshreveable/mousetrap'
package github.com/digitalocean/doctl/cmd/doctl: exit status 128

DS

Windows SSH client agent support

Doctl uses a custom ssh client because it can't assume there is a ssh executable in the path. In order to be more friendly, there should exist support for SSH agents.

Bash Completion

Feature request: We need bash completion...

doctl should show compute, account, auth ...

No .doctlconfig format specified

Hello,

Please clarify file format of .doctlconfig in documentation.
Now it look like JSON but not quote a string on another source like issue it look like:

key1: value1
key2: value2

Please describe format or/and provide information about reading parameters in debug or verbose mode.

doctl compute droplet find

please add command: doctl compute droplet find ABCD

To find matching droplet with partial name or ip or tags

Allow jsonpath traversals through doctl output

Add a jsonpath option to allow easy retrieval of specific data from a doctl response. Example:

doctl compute get 1234 --jsonpath "Networks.V4" would return the IPv4 networks block from the JSON response. JSON output is assumed with the jsonpath option.

droplet delete name disambiguation

If you have multiple droplets with the same name, e.g. "ubuntu-2gb-nyc3-01", and issue a droplet delete command, doctl deletes the oldest one.

doctl compute droplet delete ubuntu-2gb-nyc3-01

This should be documented, or there should be a disambiguation or confirmation prompt.

SSH user argument ignored

I would like to use a different user to ssh into my droplet, but I also use a different ssh key, my line is:

doctl compute ssh <my_droplet> --ssh-key-path <mykey> --ssh-user <my_user>

but the connection made to the droplet uses root instead of my username. Also any kind of arguments after --ssh-key-path are being ignored, like -v or --trace.

Software Version
doctl v1.1.0
OS OSX Yosemite 10.10.5 (14F1713)
Terminal iTerm 2 (2.1.4)
Shell zsh

Cannot run binary

I followed the installation steps of option 2.

Running doctl results in this error message: zsh: exec format error: doctl

I'm on the latest version of OSX.

How can this be fixed?

Multiple Missing Things for 'change-kernel' Action

The --format option is missing for the change-kernel action using the following command:

doctl compute droplet-action change-kernel <droplet-id>

This option exists for other similar droplet-action such as power-off.

I was updating my mass kernel updater script to use doctl instead of curl and came across this issue.

EDIT:
It also appears the --no-header option is missing too.

EDIT 2:
It appears that it does not list all kernels too. My assumption would be the paging in the DigitalOcean API.

Can't login on windows

Just tried installing the client after the twitter post was announce and wanted to login, however the client isn't being so nice about it. 1.0 Releases eh?

Anyway when attempting to login, it seems that the client is ignoring all the argument flags and not actually running the auth flow (or at least clearly stating what it does)
image 2016-03-30 at 4 48 01 pm

Also it seems to spin up my browser to an attempted auth page but all that prints is unknown client.

Goob job on a 1.0 attempt though guys, looking forward it working nicer :P

SSH Agent Forwarding

First and foremost, this tool is great and it makes my work a lot easier! Thank you!

One of the things I use quite often is SSH agent forwarding (ssh -A user@server) for example for deployment tasks. I wonder if it would be possible to add this functionality to the doctl compute ssh <droplet-name> command?

Using Doctl to rebuild a droplet

I ran doctl compute droplet list to get a droplet_id for our droplets.

One of our droplets has droplet_id 12018347.

I then ran doctl compute image list to get the image_id for the Ubuntu 14.04.4 x64 image. According to this command, the image with slug "ubuntu-14-04-x64" has the image_id 15943679.

However, when I run doctl compute droplet-action rebuild 12018347 --image-id 15943679, doctl returns the following error:

"POST https://api.digitalocean.com/v2/droplets/12018347/actions: 422 Image can't be blank"

Is this image really blank, or this is this a problem with the API? If there is another image_id that refers to a "non-blank" Ubuntu 14.04.4 x64 image, how would I find it? Is doctl compute image list not the right way?

git-style aliases

What

Allow git-style aliases for commands.

Why

Some commands are more frequently used than others by users, so allowing people to alias them to their convenience will provide a more ergonomic experience.

How

Possible impl:

  • Add the aliases definitions to the config file.
  • Before starting the cobra stuff, expand the os.Args according to the aliases.

Add a way to see private IP of the machine

I have a scenario, when I need to generate SSL certificates for a bunch of machines in the cluster. It would be nice if the output of doctl compute droplet [create|list] included the private ip (provided --enable-private-networking was issued).

Right now I have to manually ssh (since doctl compute ssh doesn't seem to take commands) into the box and run scripts to get that information, which is really inconvenient.

What broke Jim?

Receive follow problem

$ doctl auth login
login to DigitalOcean account

Usage:
  doctl auth login [flags]

Flags:
  -h, --help   help for login

Global Flags:
  -t, --access-token string   DigitalOcean API V2 Access Token
  -o, --output string         output formt [text|json] (default "text")
      --trace                 verbose output
  -v, --verbose               verbose output

Error: it's broke, Jim

What wrong? And I am is not Jim ;) How to determine my name in confg ;)

`doctl auth login` doesn't work on Mac

Contrary to the tutorial here, doctl auth login only returns Error: access token is required, if there's no config file, and doesn't pop open a browser tab.

There is no instruction given in that tutorial as to what key name to use in the config; I randomly guessed access-token, which worked.

address droplets by name

currently every action (shutdown, snapshot etc) needs the ID as parameter. this is not very practical for scripting things like this. Will it be possible to give these actions the Name of the droplet as parameter?

shutdown_and_update.sh

#!/bin/sh
doctl compute droplet-action shutdown my.droplet.com
doctl compute droplet-action snapshot my.droplet.com
 --snapshot-name my.droplet.com

restore_and_wakeup.sh

#!/bin/sh
doctl compute droplet create my.droplet.com   --size 8gb  --image my.droplet.com --region nyc1
doctl compute droplet-action power-on my.droplet.com

--user-data-file not used?

Created a droplet with the --user-data-file argument with a local file containing a few lines of shell code, which normally works when used from the control panel. The data doesn't seem to be used.

auth login does not open a new browser tab

Is anyone else finding that typing doctl auth login does not open a new browser window but outputs the usage and the error:

Error: access token is required

โ€ฆ well I thought that was what this command was suppose to figure out for me!?

I'm running OS X 10.11.4 โ€” zsh shell and Safari is my primary browser if it helps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.