Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Restore the previous cloudformation_resource_type_for_back_compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Niall Creech committed Jan 21, 2016
1 parent 2e034b8 commit 8c3c2e6
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions bootstrap_cfn/cloudformation.py
Expand Up @@ -63,13 +63,26 @@ def get_stack_load_balancers(self, stack_name_or_id):
resource_type = 'AWS::ElasticLoadBalancing::LoadBalancer'
return get_resource_type(stack_name_or_id, resource_type)

def get_resource_type(self,
stack_name_or_id,
resource_type=None):
def get_resource_type(self, stack_name_or_id, resource_type=None):
"""
Backwards compatible call to get_resource_type
Collect up a set of specific stack resources
Args:
stack_name_or_id (string): Name or id used to identify the stack
resource_type(string): The resource type identifier
Returns:
resources: Set of stack resources containing only
the resource type for this stack
"""
return get_resource_type(stack_name_or_id, resource_type)
# get the stack
resources = []
stack = self.conn_cfn.describe_stacks(stack_name_or_id)
if stack:
resources = stack[0].list_resources()
if resource_type:
# get the resources
resources = filter(lambda x: x.resource_type == resource_type,
resources)
return resources


def get_resource_type(stack_name_or_id,
Expand Down

0 comments on commit 8c3c2e6

Please sign in to comment.