Blob Blame History Raw
From 984a7f68c9172f3429f80cb057fa4a602efd09a5 Mon Sep 17 00:00:00 2001
From: Kamil Páral <kparal@redhat.com>
Date: Jul 01 2019 14:31:18 +0000
Subject: ask user to open URL manually because of Bodhi bug


Because of [1] we can't add a comment from f-e-k. Until it is resolved,
ask the user to open the URL manually. This is very suboptimal, but it's
still better than be completely broken - at least the user is able to
figure out *which* updates he/she can comment on.

[1] https://github.com/fedora-infra/bodhi/issues/3298

---

diff --git a/fedora-easy-karma.py b/fedora-easy-karma.py
index 2dd7739..ae0e649 100755
--- a/fedora-easy-karma.py
+++ b/fedora-easy-karma.py
@@ -698,24 +698,35 @@ class FedoraEasyKarma(object):
                                               self.options.fas_username):
                         print("!!! already commented by you !!!")
                     try:
-                        karma = self.raw_input(
-                            PROMPT, default=self.options.default_karma,
-                            add_to_history=False)
-                        if karma in ["-1", "0", "1"]:
-                            comment = self.raw_input(
-                                "Comment> ",
-                                default=self.options.default_comment)
-                            if comment or not self.options.skip_empty_comment:
-                                result = self.send_comment(bc, update, comment,
-                                                           karma)
-                                if not result[0]:
-                                    self.warning("Comment not submitted: %s" %
-                                                 result[1])
-                            else:
-                                print("skipped because of empty comment")
-                        elif karma == "i":
-                            ignored_updates.append(update.title)
-                            print("ignored as requested")
+                        while True:
+                            karma = self.raw_input(
+                                PROMPT, default=self.options.default_karma,
+                                add_to_history=False)
+                            if karma in ["-1", "0", "1"]:
+                                # Disable this temporarily
+                                # See: https://pagure.io/fedora-easy-karma/issue/6
+                                # See: https://github.com/fedora-infra/bodhi/issues/3298
+                                print("Posting karma to Bodhi unfortunatelly doesn't "
+                                    "work at the moment due to a Bodhi bug. Until it "
+                                    "is resolved, please open the URL shown above "
+                                    "manually and add a comment through the website, "
+                                    "thank you.")
+                                continue
+                                comment = self.raw_input(
+                                    "Comment> ",
+                                    default=self.options.default_comment)
+                                if comment or not self.options.skip_empty_comment:
+                                    result = self.send_comment(bc, update, comment,
+                                                               karma)
+                                    if not result[0]:
+                                        self.warning("Comment not submitted: %s" %
+                                                     result[1])
+                                else:
+                                    print("skipped because of empty comment")
+                            elif karma == "i":
+                                ignored_updates.append(update.title)
+                                print("ignored as requested")
+                            break
 
                     except EOFError:
                         ignored_updates.extend(previously_ignored_updates)