Merge branch 'master' of github.com:imduffy14/ec2stack
* 'master' of github.com:imduffy15/ec2stack:
Fix name in security_groups.py
Merge cloudstack.__init__.py
Return empty set, instead of error if description of items is empty
diff --git a/ec2stack/providers/cloudstack/__init__.py b/ec2stack/providers/cloudstack/__init__.py
index d828bfd..7115826 100644
--- a/ec2stack/providers/cloudstack/__init__.py
+++ b/ec2stack/providers/cloudstack/__init__.py
@@ -9,7 +9,7 @@
if helpers.contains_parameter_with_keyword(prefix):
response = _describe_specific_item(args, keyname, not_found, prefix)
else:
- response = describe_items_request(args, not_found)
+ response = describe_items_request(args, {})
return response
@@ -53,5 +53,7 @@
if 'count' in response:
return response
- else:
+ elif callable(not_found):
return not_found()
+ else:
+ return not_found
diff --git a/ec2stack/providers/cloudstack/security_groups.py b/ec2stack/providers/cloudstack/security_groups.py
index a255834..da8ef02 100644
--- a/ec2stack/providers/cloudstack/security_groups.py
+++ b/ec2stack/providers/cloudstack/security_groups.py
@@ -78,12 +78,12 @@
args, 'securitygroup', errors.invalid_security_group, 'Group'
)
- return _describe_images_response(
+ return _describe_security_groups_response(
response
)
-def _describe_images_response(response):
+def _describe_security_groups_response(response):
return {
'template_name_or_list': 'securitygroups.xml',
'response_type': 'DescribeSecurityGroupsResponse',
diff --git a/ec2stack/templates/instances.xml b/ec2stack/templates/instances.xml
index 04ae952..70d7143 100644
--- a/ec2stack/templates/instances.xml
+++ b/ec2stack/templates/instances.xml
@@ -1,6 +1,7 @@
{% extends "response.xml" %}
{% block response_content %}
<reservationSet>
+ {% if response %}
<item>
<reservationId>None</reservationId>
<instancesSet>
@@ -52,5 +53,6 @@
{% endfor %}
</instancesSet>
</item>
+ {% endif %}
</reservationSet>
{% endblock %}
\ No newline at end of file
diff --git a/tests/images_tests.py b/tests/images_tests.py
index 6fa3a5e..71b1f31 100644
--- a/tests/images_tests.py
+++ b/tests/images_tests.py
@@ -75,7 +75,7 @@
def test_empty_response_describe_images_by_id(self):
data = self.get_example_data()
data['Action'] = 'DescribeImages'
- data['InstanceId.1'] = 'invalid-images-id'
+ data['ImageId.1'] = 'invalid-images-id'
data['Signature'] = generate_signature(data, 'POST', 'localhost')
get = mock.Mock()