Merge lp:~achiang/hydrazine/hydrazine-fix-official-tags into lp:hydrazine

Proposed by Alex Chiang
Status: Merged
Merged at revision: 94
Proposed branch: lp:~achiang/hydrazine/hydrazine-fix-official-tags
Merge into: lp:hydrazine
Diff against target: 16 lines (+4/-1)
1 file modified
bugclient (+4/-1)
To merge this branch: bzr merge lp:~achiang/hydrazine/hydrazine-fix-official-tags
Reviewer Review Type Date Requested Status
Martin Pool Approve
Review via email: mp+79059@code.launchpad.net

Description of the change

  bugclient: fix stacktrace in do_official_tags when there are no tags

  Slight refactor of logic to return early if there are no official tags
  defined for a pillar. Without this fix, we get the following stack trace:

  Traceback (most recent call last):
    File "./bugclient", line 519, in <module>
      main(sys.argv)
    File "./bugclient", line 515, in main
      cmd.cmdloop()
    File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
      stop = self.onecmd(line)
    File "./bugclient", line 379, in onecmd
      return cmd.Cmd.onecmd(self, cmdline)
    File "/usr/lib/python2.7/cmd.py", line 219, in onecmd
      return func(arg)
    File "./bugclient", line 233, in do_official_tags
      _show_columnated(tags)
    File "./bugclient", line 465, in _show_columnated
      longest = max(map(len, tags))
  ValueError: max() arg is an empty sequence

To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

  vote approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bugclient'
2--- bugclient 2011-10-12 03:14:13 +0000
3+++ bugclient 2011-10-12 05:51:16 +0000
4@@ -228,8 +228,11 @@
5 def do_official_tags(self, ignored):
6 """Show the official tags for the current pillar."""
7 if self._needs_pillar(): return
8+ tags = self.pillar.official_bug_tags
9+ if not tags:
10+ print 'No official bug tags for %s' % self.pillar.name
11+ return
12 print 'Official bug tags for %s' % self.pillar.name
13- tags = self.pillar.official_bug_tags
14 _show_columnated(tags)
15
16 def do_open(self, ignored):

Subscribers

People subscribed via source and target branches

to all changes: