Comments (12)
Seems to be connected with #58
from python-digitalocean.
Doesn't seem to be related, I'm provisioning using the full public key (ssh-rsa XXXX name
), not the ID (12345
)
from python-digitalocean.
What is the code that is giving you the error? What error do you get?
from python-digitalocean.
droplet = digitalocean.Droplet(
token=DO_TOKEN,
name=name,
region=region,
image="ubuntu-14-04-x64",
size="512mb",
user_data=get_file_contents('./provision/userdata-master.sh'))
before {'region': 'lon1', 'image': 'ubuntu-14-04-x64', 'ssh_keys[]': 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDamhNXrDTXeZ/Rj1EiQXE3Jidd5BZCwQQuqItOh6Vdd3KiJwiNC/4ZQEvJFJOUoOFU9sh2eFPEY4qa/M9B/5/RIyBJApg9x926PbsEtEYRZoMivO9oeN5whDP0LCExoIw4AD1A0+JuD87WJ22VIoSHbpl8eJ2TGpvSc3VO7ewLHPkXcW/0RiNOHM4jxfuMmg3msWlAJLfImwWCe+I6LCsQpy/R/o+NyCn7318QRItcSsFvbr7BlssW9ENEmU9WZMFVZueLskgZQ7012ykIb9Q2KAR1Epjupl2BWoNcFZxr1wI9cYTJcwNs7uu7bSY/dU63JDhdKxpEKxe4oyYEOA5z deployclient\n', 'name': 'salt1.lon1', 'size': '512mb'}
after {u'droplet': {u'status': u'new', u'kernel': {u'version': u'3.13.0-32-generic', u'id': 1682, u'name': u'Ubuntu 14.04 x64 vmlinuz-3.13.0-32-generic'}, u'locked': True, u'name': u'salt1.lon1', u'backup_ids': [], u'created_at': u'2014-10-24T20:00:46Z', u'snapshot_ids': [], u'size_slug': u'512mb', u'networks': {}, u'vcpus': 1, u'image': {}, u'memory': 512, u'region': {}, u'disk': 20, u'id': 2964817, u'features': [u'virtio']}, u'links': {u'actions': [{u'href': u'https://api.digitalocean.com/v2/actions/35130982', u'id': 35130982, u'rel': u'create'}]}}
Obtained by adding some debug;
print "before", data
data = self.get_data(
"droplets",
type="POST",
params=data
)
print "after", data
from python-digitalocean.
Instead of using ssh_keys with a list of ssh keys, you should use it with a list of SSHKey id.
So the best practice is:
key = SSHKey()
key.token = "YOUR TOKEN"
key.public_key = "YOUR PUBLIC KEY GOES HERE"
key.name = "The name"
key.create()
And then use the ID in this way:
droplet = digitalocean.Droplet(
token=DO_TOKEN,
name=name,
region=region,
image="ubuntu-14-04-x64",
size="512mb",
user_data=get_file_contents('./provision/userdata-master.sh'),
ssh_keys=[key.id] )
It should work, I will create some better documentation!
from python-digitalocean.
The documentation states that this shouldn't be necessary, and allows you to specify either the ID or the full public key.
from python-digitalocean.
I am checking this. Meanwhile you can use the code I shared with you to keep working. Let me know if there is anything else that is not working using this API module! 👍
from python-digitalocean.
@foxx Have you tried using the fingerprint and not the public key?
Get it in this way:
ssh-keygen -lf ~/.ssh/id_rsa.pub
from python-digitalocean.
Sounds good, thanks for sharing!
from python-digitalocean.
I also tried with the fingerprint just now, still no luck. I'll use the method you suggested before, thanks.
from python-digitalocean.
I have the same problem now, and I am testing again. Thanks for sharing this.
from python-digitalocean.
Now this bug should be fixed: if you put a SSH key as string in droplet.ssh_keys list, this key became "an ID". This means that the system will look for the ssh_key in digital ocean, if it is there, it will use its ID. Otherwise it will create a new SSHKey object on DO uploading the pub key and getting the ID.
This is a temporary workaround in order to avoid problem with digital ocean ssh key. I tested this also with multiple SSH_Keys and seems to work fine.
from python-digitalocean.
Related Issues (20)
- Load balancer and certificate APIs are returning digitalocean.NotFoundError
- Unable to import module 'Manager' HOT 1
- the API v2 does not seem to provide account name aka team name aka user name. Can advise?
- droplet shutdown is not working HOT 1
- Delete a domain record HOT 4
- Make droplet.create() return a value - so it can be used with 'await' ? HOT 1
- Getting Credits information HOT 1
- No get_actions() for Volume? HOT 1
- Proposing a PR to fix a few small typos
- New release HOT 3
- RedRocket.pssss HOT 1
- Domain.create_new_domain_record ttl kwarg is ignored HOT 1
- Kuberenetes Support HOT 1
- Floating IP Error - digitalocean.DataReadError: HOT 1
- DigitalOcean Api token HOT 2
- Error (400/500) responses with no body raise JSONReadError
- Monitoring metrics from API
- Apps Support
- Add with_droplet_agent support
- Adding type annotation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-digitalocean.