lp-tag.py: be prepared for empty lines in input

Change-Id: Ife608108c22c38fe9913a5ed6095d643832cbd12
This commit is contained in:
Ihar Hrachyshka 2017-06-13 14:54:22 -07:00
parent ffe14d7ed9
commit d15e2b8901
1 changed files with 8 additions and 7 deletions

View File

@ -35,13 +35,14 @@ def main():
lp = Launchpad.login_with('openstack-releasing', 'production') lp = Launchpad.login_with('openstack-releasing', 'production')
bugnums = [line.strip() for line in sys.stdin.readlines()] bugnums = [line.strip() for line in sys.stdin.readlines()]
for bugnum in bugnums: for bugnum in bugnums:
bug = lp.bugs[bugnum] if bugnum:
tag = args.tag bug = lp.bugs[bugnum]
tags = bug.tags tag = args.tag
if tag not in tags: tags = bug.tags
tags.append(tag) if tag not in tags:
bug.tags = tags tags.append(tag)
bug.lp_save() bug.tags = tags
bug.lp_save()
if __name__ == '__main__': if __name__ == '__main__':