#2085 hide local --debug options
Merged 3 years ago by tkopecek. Opened 4 years ago by tkopecek.
tkopecek/koji issue2084  into  master

file modified
+14 -6
@@ -1547,7 +1547,7 @@ 

          session.writeSignedRPM(rpminfo['id'], key)

  

  

- def handle_prune_signed_copies(options, session, args):

+ def handle_prune_signed_copies(goptions, session, args):

      "[admin] Prune signed copies"

      usage = _("usage: %prog prune-sigs [options]")

      parser = OptionParser(usage=get_usage_str(usage))
@@ -1565,7 +1565,9 @@ 

      parser.add_option("--protect-tag-file",

                        help=_("File to read tag protect patterns from"))

      parser.add_option("--trashcan-tag", default="trashcan", help=_("Specify trashcan tag"))

-     parser.add_option("--debug", action="store_true", help=_("Show debugging output"))

+     # Don't use local debug option, this one stays here for backward compatibility

+     # https://pagure.io/koji/issue/2084

+     parser.add_option("--debug", action="store_true", default=goptions.debug, help=SUPPRESS_HELP)

      (options, args) = parser.parse_args(args)

      # different ideas/modes

      #  1) remove all signed copies of builds that are not latest for some tag
@@ -2056,7 +2058,9 @@ 

      "[admin] List signed copies of rpms"

      usage = _("usage: %prog list-signed [options]")

      parser = OptionParser(usage=get_usage_str(usage))

-     parser.add_option("--debug", action="store_true")

+     # Don't use local debug option, this one stays here for backward compatibility

+     # https://pagure.io/koji/issue/2084

+     parser.add_option("--debug", action="store_true", default=goptions.debug, help=SUPPRESS_HELP)

      parser.add_option("--key", help=_("Only list RPMs signed with this key"))

      parser.add_option("--build", help=_("Only list RPMs from this build"))

      parser.add_option("--rpm", help=_("Only list signed copies for this RPM"))
@@ -2135,7 +2139,7 @@ 

          builddir = koji.pathinfo.build(binfo)

          signedpath = "%s/%s" % (builddir, koji.pathinfo.signed(rinfo, sigkey))

          if not os.path.exists(signedpath):

-             if options.debug:

+             if goptions.debug:

                  print("No copy: %s" % signedpath)

              continue

          print(signedpath)
@@ -4132,7 +4136,9 @@ 

      "[info] Print a history of tag operations"

      usage = _("usage: %prog list-tag-history [options]")

      parser = OptionParser(usage=get_usage_str(usage))

-     parser.add_option("--debug", action="store_true")

+     # Don't use local debug option, this one stays here for backward compatibility

+     # https://pagure.io/koji/issue/2084

+     parser.add_option("--debug", action="store_true", default=goptions.debug, help=SUPPRESS_HELP)

      parser.add_option("--build", help=_("Only show data for a specific build"))

      parser.add_option("--package", help=_("Only show data for a specific package"))

      parser.add_option("--tag", help=_("Only show data for a specific tag"))
@@ -4431,7 +4437,9 @@ 

      "[info] Display historical data"

      usage = _("usage: %prog list-history [options]")

      parser = OptionParser(usage=get_usage_str(usage))

-     parser.add_option("--debug", action="store_true")

+     # Don't use local debug option, this one stays here for backward compatibility

+     # https://pagure.io/koji/issue/2084

+     parser.add_option("--debug", action="store_true", default=goptions.debug, help=SUPPRESS_HELP)

      parser.add_option("--build", help=_("Only show data for a specific build"))

      parser.add_option("--package", help=_("Only show data for a specific package"))

      parser.add_option("--tag", help=_("Only show data for a specific tag"))

With this change, a command that used to work (koji list-signed --debug) will stop working.
We should avoid situations like that.

I disagree with the issue itself and I will comment further there.

rebased onto c71c1f7

3 years ago

Commit 9e19626 fixes this pull-request

Pull-Request has been merged by tkopecek

3 years ago

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

3 years ago

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

3 years ago