Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect iterator chaining in get_permissions calls #4380

Merged
merged 1 commit into from Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion c7n/resources/ami.py
Expand Up @@ -276,7 +276,7 @@ class ImageUnusedFilter(Filter):
schema = type_schema('unused', value={'type': 'boolean'})

def get_permissions(self):
return list(itertools.chain([
return list(itertools.chain(*[
self.manager.get_resource_manager(m).get_permissions()
for m in ('asg', 'launch-config', 'ec2')]))

Expand Down
2 changes: 1 addition & 1 deletion c7n/resources/asg.py
Expand Up @@ -243,7 +243,7 @@ def __call__(self, asg):
class ConfigValidFilter(Filter):

def get_permissions(self):
return list(itertools.chain([
return list(itertools.chain(*[
self.manager.get_resource_manager(m).get_permissions()
for m in ('subnet', 'security-group', 'key-pair', 'elb',
'app-elb-target-group', 'ebs-snapshot', 'ami')]))
Expand Down
2 changes: 1 addition & 1 deletion c7n/resources/ebs.py
Expand Up @@ -268,7 +268,7 @@ class SnapshotUnusedFilter(Filter):
schema = type_schema('unused', value={'type': 'boolean'})

def get_permissions(self):
return list(itertools.chain([
return list(itertools.chain(*[
self.manager.get_resource_manager(m).get_permissions()
for m in ('asg', 'launch-config', 'ami')]))

Expand Down
2 changes: 1 addition & 1 deletion c7n/resources/iam.py
Expand Up @@ -504,7 +504,7 @@ def get_eval_matcher(self):
class IamRoleUsage(Filter):

def get_permissions(self):
perms = list(itertools.chain([
perms = list(itertools.chain(*[
self.manager.get_resource_manager(m).get_permissions()
for m in ['lambda', 'launch-config', 'ec2']]))
perms.extend(['ecs:DescribeClusters', 'ecs:DescribeServices'])
Expand Down
2 changes: 1 addition & 1 deletion c7n/resources/vpc.py
Expand Up @@ -666,7 +666,7 @@ class SGUsage(Filter):

def get_permissions(self):
return list(itertools.chain(
[self.manager.get_resource_manager(m).get_permissions()
*[self.manager.get_resource_manager(m).get_permissions()
for m in
['lambda', 'eni', 'launch-config', 'security-group']]))

Expand Down