Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:imduffy14/ec2stack
Browse files Browse the repository at this point in the history
* '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
  • Loading branch information
imduffy15 committed Mar 5, 2014
2 parents b1f50cf + f38734d commit 2fb2d3e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions ec2stack/providers/cloudstack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def describe_item(args, keyname, not_found, prefix):
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

Expand Down Expand Up @@ -53,5 +53,7 @@ def describe_items_request(args, not_found):

if 'count' in response:
return response
else:
elif callable(not_found):
return not_found()
else:
return not_found
4 changes: 2 additions & 2 deletions ec2stack/providers/cloudstack/security_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def describe_security_groups():
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',
Expand Down
2 changes: 2 additions & 0 deletions ec2stack/templates/instances.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "response.xml" %}
{% block response_content %}
<reservationSet>
{% if response %}
<item>
<reservationId>None</reservationId>
<instancesSet>
Expand Down Expand Up @@ -52,5 +53,6 @@
{% endfor %}
</instancesSet>
</item>
{% endif %}
</reservationSet>
{% endblock %}
2 changes: 1 addition & 1 deletion tests/images_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_invalid_describe_image_by_id(self):
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()
Expand Down

0 comments on commit 2fb2d3e

Please sign in to comment.