#2044 Unify error messages in CLI
Merged by tkopecek. Opened by tkopecek.
tkopecek/koji issue2043  into  master

Download 2044.patch

pretty please pagure-ci rebuild

rebased onto bcf14478d5fe862a43244f5244411e2c559785a0

         id = session.addHost(host, args[1:], **kwargs)
-        if id:
-            print("%s added: id %d" % (host, id))
+        print("%s added: id %d" % (host, id))

This change seems out of place in context. It's true that addHost can't return None, but this change shouldn't be lumped in with the rest. If we're going to do more general cleanup here, might as well rename that id variable too ;)

                 if not binfo:
-                    print(_("No such build: %s") % nvr)
+                    error(_("No such build: %s") % nvr)
                 else:
-                    print(_("Build %s not in tag %s") % (nvr, tag['name']))
+                    error(_("Build %s not in tag %s") % (nvr, tag['name']))
                 if not options.force:
-                    return 1
+                    error()

The old code would not raise these errors with --force, but looks like this will in all cases. Maybe...

                binfo = session.getBuild(nvr)
                msg = warn if options.force else error
                if not binfo:
                    msg(_("No such build: %s") % nvr)
                else:
                    msg(_("Build %s not in tag %s") % (nvr, tag['name']))

otherwise looks ok, though will conflict with #2038, maybe more

rebased onto 7c5b237e660714144b3c7914bc34a3fa9315ab9e

Commit 6a07c503 fixes this pull-request

Pull-Request has been merged by tkopecek

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

Metadata