python-apache-libcloud/ec2_create_node.patch
Niels Abspoel 1e46830db8 Accepting request 639059 from home:seanmarlow:branches:devel:languages:python
Add ec2_create_node.patch to allow for instance type strings in create_node method. This is helpful since instance_types are constantly being added in EC2.

Upstream discussion: https://issues.apache.org/jira/browse/LIBCLOUD-1018

OBS-URL: https://build.opensuse.org/request/show/639059
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-apache-libcloud?expand=0&rev=81
2018-09-28 20:50:48 +00:00

25 lines
878 B
Diff

Index: apache-libcloud-2.3.0/libcloud/compute/drivers/ec2.py
===================================================================
--- apache-libcloud-2.3.0.orig/libcloud/compute/drivers/ec2.py
+++ apache-libcloud-2.3.0/libcloud/compute/drivers/ec2.py
@@ -3907,12 +3907,18 @@ class BaseEC2NodeDriver(NodeDriver):
"""
image = kwargs["image"]
size = kwargs["size"]
+
+ try:
+ instance_type = size.id
+ except AttributeError:
+ instance_type = size
+
params = {
'Action': 'RunInstances',
'ImageId': image.id,
'MinCount': str(kwargs.get('ex_mincount', '1')),
'MaxCount': str(kwargs.get('ex_maxcount', '1')),
- 'InstanceType': size.id
+ 'InstanceType': instance_type
}
if kwargs.get("ex_terminate_on_shutdown", False):