Skip to content

Commit 825f779

Browse files
llangeavram
authored andcommitted
Update tags_spec for Lambda.functions (#121)
We can now retrieve Lambda.functions tag list. A change was needed to handle the format of the tag list returned by the Lambda list_tags function.
1 parent 158ebde commit 825f779

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

skew/resources/aws/__init__.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,17 @@ def tags(self):
160160
LOG.debug(self.data['Tags'])
161161

162162
if 'Tags' in self.data:
163-
for kvpair in self.data['Tags']:
164-
if kvpair['Key'] in self._tags:
165-
if not isinstance(self._tags[kvpair['Key']], list):
166-
self._tags[kvpair['Key']] = [self._tags[kvpair['Key']]]
167-
self._tags[kvpair['Key']].append(kvpair['Value'])
168-
else:
169-
self._tags[kvpair['Key']] = kvpair['Value']
163+
_tags = self.data['Tags']
164+
if isinstance(_tags, list):
165+
for kvpair in _tags:
166+
if kvpair['Key'] in self._tags:
167+
if not isinstance(self._tags[kvpair['Key']], list):
168+
self._tags[kvpair['Key']] = [self._tags[kvpair['Key']]]
169+
self._tags[kvpair['Key']].append(kvpair['Value'])
170+
else:
171+
self._tags[kvpair['Key']] = kvpair['Value']
172+
elif isinstance(_tags, dict):
173+
self._tags = _tags
170174
return self._tags
171175

172176
def find_metric(self, metric_name):

skew/resources/aws/lambda.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class Meta(object):
4444
name = 'FunctionName'
4545
date = 'LastModified'
4646
dimension = 'FunctionName'
47+
tags_spec = ('list_tags', 'Tags',
48+
'Resource', 'arn')
4749

4850
@classmethod
4951
def filter(cls, arn, resource_id, data):

0 commit comments

Comments
 (0)