New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve GCE create_node, make sure ex_get_disktype function will not fail #448

Closed
wants to merge 1 commit into
base: trunk
from

Conversation

Projects
None yet
2 participants
@mgogoulos
Contributor

mgogoulos commented Feb 10, 2015

create_node supports passing ex_disk_type as either str or GCEDiskType. If you pass an str, or if you don't pass anything -most usual case I believe- it gets an str value of 'pd-standard' since it is a kwarg, then the function will fail because self.ex_get_disktype is called without the location, and line
request = '/zones/%s/diskTypes/%s' % (zone.name, name)

will break with a 'NoneType' object has no attribute 'name'

This can easily be fixed with this commit (also applies to ex_create_multiple_nodes).

Then nodes with ssh key deployed are easily created:

from libcloud.compute.providers import get_driver; from libcloud.compute.types import Provider; driver = get_driver('gce')
conn = driver('email', 'key', project='project')
node = conn.create_node(
                name=machine_name, # str
                image=image, # NodeImage
                size=size, # NodeSize
                location=location, # NodeLocation
                ex_metadata=metadata # {'sshKeys': 'user:%s' % public_ssh_rsa_key}
            )
@erjohnso

This comment has been minimized.

Show comment
Hide comment
@erjohnso

erjohnso Feb 11, 2015

Member

Looks good @mgogoulos, but tests are not passing. Do you think you can take a look at travis and get them fixed up? For example, https://travis-ci.org/apache/libcloud/jobs/50234015#L5396.

Member

erjohnso commented Feb 11, 2015

Looks good @mgogoulos, but tests are not passing. Do you think you can take a look at travis and get them fixed up? For example, https://travis-ci.org/apache/libcloud/jobs/50234015#L5396.

@mgogoulos

This comment has been minimized.

Show comment
Hide comment
@mgogoulos

mgogoulos Feb 11, 2015

Contributor

I've added the missing fixture for this, it should complete fine!

Contributor

mgogoulos commented Feb 11, 2015

I've added the missing fixture for this, it should complete fine!

@mgogoulos

This comment has been minimized.

Show comment
Hide comment
@mgogoulos

mgogoulos Feb 11, 2015

Contributor

Forgot to include the new fixtures file..

Contributor

mgogoulos commented Feb 11, 2015

Forgot to include the new fixtures file..

@erjohnso

This comment has been minimized.

Show comment
Hide comment
@erjohnso

erjohnso Feb 11, 2015

Member

Great, thank you very much @mgogoulos! One last request, could you please rebase and squash into a single commit? See, https://libcloud.readthedocs.org/en/latest/development.html#squash-the-commits-and-generate-the-patch. We don't need the patch, but see the two Notes in that section for rebasing/squashing if you've never done it.

Member

erjohnso commented Feb 11, 2015

Great, thank you very much @mgogoulos! One last request, could you please rebase and squash into a single commit? See, https://libcloud.readthedocs.org/en/latest/development.html#squash-the-commits-and-generate-the-patch. We don't need the patch, but see the two Notes in that section for rebasing/squashing if you've never done it.

@mgogoulos

This comment has been minimized.

Show comment
Hide comment
@mgogoulos

mgogoulos Feb 12, 2015

Contributor

Should be fine now, after tests complete!

Contributor

mgogoulos commented Feb 12, 2015

Should be fine now, after tests complete!

@erjohnso

This comment has been minimized.

Show comment
Hide comment
@erjohnso

erjohnso Feb 13, 2015

Member

Thank you very much @mgogoulos - merging now.

Member

erjohnso commented Feb 13, 2015

Thank you very much @mgogoulos - merging now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment