Giter Club home page Giter Club logo

Comments (12)

koalalorenzo avatar koalalorenzo commented on July 28, 2024

Seems to be connected with #58

from python-digitalocean.

foxx avatar foxx commented on July 28, 2024

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.

koalalorenzo avatar koalalorenzo commented on July 28, 2024

What is the code that is giving you the error? What error do you get?

from python-digitalocean.

foxx avatar foxx commented on July 28, 2024
            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.

koalalorenzo avatar koalalorenzo commented on July 28, 2024

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.

foxx avatar foxx commented on July 28, 2024

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.

koalalorenzo avatar koalalorenzo commented on July 28, 2024

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.

koalalorenzo avatar koalalorenzo commented on July 28, 2024

@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.

foxx avatar foxx commented on July 28, 2024

Sounds good, thanks for sharing!

from python-digitalocean.

foxx avatar foxx commented on July 28, 2024

I also tried with the fingerprint just now, still no luck. I'll use the method you suggested before, thanks.

from python-digitalocean.

koalalorenzo avatar koalalorenzo commented on July 28, 2024

I have the same problem now, and I am testing again. Thanks for sharing this.

from python-digitalocean.

koalalorenzo avatar koalalorenzo commented on July 28, 2024

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)

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.