libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [libcloud] jmgnc opened a new issue #1419: ec2 driver does not support strings for size and image parameters
Date Tue, 28 Jan 2020 17:55:24 GMT
jmgnc opened a new issue #1419: ec2 driver does not support strings for size and image parameters
   ## Summary
   Both the GCP and the Dummy drivers for compute allow passing the imaged id, and size id
as a string, and both drivers will do a lookup to find them.
   The EC2 driver requires that the image and size be objects that have the name as an id
   ## Detailed Information
   The commit
fixes the issue for that code.  GCP works w/ the previous commit.
   This is on MacOSX 10.14.6.
   Python 3.6.7 (default, Oct 21 2018, 08:56:20)
   [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.2)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import libcloud
   >>> libcloud.__version__
   >>> from libcloud.compute.types import Provider
   >>> from libcloud.compute.providers import get_driver
   >>> cls = get_driver(Provider.EC2)
   >>> access_key, secret_key = open('.keys').read().split()
   >>> drv = cls(access_key, secret_key, region='us-west-2')
   >>> drv.create_node(image='ami-0b74be4bc329b8a1b', size='t2.nano')
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/Users/jmg/work/openc2-aws-actuator/p/lib/python3.6/site-packages/libcloud/compute/drivers/",
line 1891, in create_node                                                           
   AttributeError: 'str' object has no attribute 'id'
   >>> from mock import MagicMock
   >>> img = MagicMock()
   >>> = 'ami-0b74be4bc329b8a1b'
   >>> sizeobj = MagicMock()
   >>> = 't2.nano'
   >>> drv.create_node(image=img, size=sizeobj, name='somename')
   <Node: uuid=2ba587a276a105f6676e4df1957ff89926206dbb, name=somename, state=PENDING,
public_ips=[], private_ips=[''], provider=Amazon EC2 ...>                 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message