lss3: code cleanup and addition of displaying bucket tags #2132

Merged
merged 3 commits into from Mar 5, 2014

Conversation

Projects
None yet
2 participants
Contributor

jimbrowne commented Feb 27, 2014

Add -t option for displaying tags on buckets when listing all buckets.

PEP8/pyflakes and some pylint.

@danielgtaylor danielgtaylor commented on an outdated diff Feb 27, 2014

"""List all the buckets"""
for b in s3.get_all_buckets():
print b.name
+ if display_tags:
+ try:
+ tags = b.get_tags()
+ for tag in tags[0]:
+ print " %s:%s" % (tag.key, tag.value)
+ except:
+ pass
@danielgtaylor

danielgtaylor Feb 27, 2014

Owner

Should we let the user know that there was an issue fetching tags instead of failing silently and making it seem like there are no tags? This could be dumped into stderr instead of stdout and just contain a quick message about the problem and which bucket was involved.

Contributor

jimbrowne commented Mar 1, 2014

I have updated the code to only swallow 404 exceptions. The s3 code raises tagSet not found (i.e. 404) as an exception rather than returning None. The updated code will raise any other exceptions up the chain.

Owner

danielgtaylor commented Mar 5, 2014

This looks great, thanks 👍

danielgtaylor self-assigned this Mar 5, 2014

@danielgtaylor danielgtaylor added a commit that referenced this pull request Mar 5, 2014

@danielgtaylor danielgtaylor Merge pull request #2132 from jimbrowne/lss3_improvements
Add optional bucket tags to `lss3` output. Fixes #2132.
0f35924

@danielgtaylor danielgtaylor merged commit 0f35924 into boto:develop Mar 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment