libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgogoulos <...@git.apache.org>
Subject [GitHub] libcloud pull request: improve GCE create_node, make sure ex_get_d...
Date Tue, 10 Feb 2015 17:31:39 GMT
GitHub user mgogoulos opened a pull request:

    https://github.com/apache/libcloud/pull/448

    improve GCE create_node, make sure ex_get_disktype function will not fail

    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}
                )
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mgogoulos/libcloud gce_create_node_disktype

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/libcloud/pull/448.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #448
    
----
commit 82709b26f4e8aa8350e6b1321cd50bb7380232f8
Author: Markos Gogoulos <mgogoulos@mist.io>
Date:   2015-02-10T16:50:55Z

    improve GCE create_node, make sure ex_get_disktype function will not fail

commit aa2a8a48853650b7d0de23cd4c2db7982184d347
Author: Markos Gogoulos <mgogoulos@mist.io>
Date:   2015-02-10T17:30:52Z

    remove redundant line

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message