Skip to content
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 from

Conversation

@mgogoulos
Copy link
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
Copy link
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
Copy link
Contributor Author

mgogoulos commented Feb 11, 2015

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

@mgogoulos
Copy link
Contributor Author

mgogoulos commented Feb 11, 2015

Forgot to include the new fixtures file..

@erjohnso
Copy link
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 mgogoulos force-pushed the mgogoulos:gce_create_node_disktype branch from 4c2a21c to 6b82405 Feb 12, 2015
@mgogoulos
Copy link
Contributor Author

mgogoulos commented Feb 12, 2015

Should be fine now, after tests complete!

@erjohnso
Copy link
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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.