#1 Increase the information shown by default and fix checking if a package exists in bugzilla
Merged 3 years ago by zlopez. Opened 3 years ago by pingou.
fedora-infra/ pingou/toddlers pr50  into  distgit_bugzilla_sync

file modified
+1 -1
@@ -129,7 +129,7 @@ 

  # Admin addresses to notify

  notify_admins = [

      "root@localhost.localdomain",

-     ]

+ ]

  

  # PDC types mapping for distgit_bugzilla_sync toddler

  [consumer_config.distgit_bugzilla_sync.pdc_types]

@@ -158,8 +158,10 @@ 

  

          _log.debug("Building bugzilla's products in-memory cache")

          product_cache = {}

-         for collection, product in config["products"].items():

-             product_cache.update(bugzilla_system.get_product_info_packages(collection))

+         for collection in config["products"]:

+             product_cache[collection] = bugzilla_system.get_product_info_packages(

+                 collection

+             )

          times["BZ cache building end"] = time.time()

  

          if dry_run:
@@ -209,14 +211,14 @@ 

  

                  qa_contact_email = config["default_qa_contact"]

  

-                 package = project["name"].lower()

+                 package = project["name"]

                  try:

-                     if package in product_cache:

+                     if package in product_cache.get(product, []):

                          bugzilla_system.edit_component(

                              owner=fas_to_bz_mail[owner],

                              product=product,

-                             package=package,

-                             component=product_cache[package],

+                             package=project["name"],

+                             component=product_cache[product][package],

                              cc_list=cc_list,

                              versions=config["products"][product]["versions"],

                              description=project["summary"],
@@ -230,7 +232,7 @@ 

                          bugzilla_system.add_component(

                              product=product,

                              owner=fas_to_bz_mail[owner],

-                             package=package,

+                             package=project["name"],

                              qa_contact=qa_contact_email,

                              cc_list=cc_list,

                              fas_users_info=bz_mail_to_fas,
@@ -292,29 +294,28 @@ 

                      mail_server, admin_email, notify_admins, report

                  )

  

-         if _log.isEnabledFor(logging.DEBUG):

-             times["end"] = time.time()

+         times["end"] = time.time()

  

-             _log.debug("   ----------")

-             _log.debug("Building the data structure")

-             delta = times["data structure end"] - times["start"]

-             _log.debug("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

+         _log.info("   ----------")

+         _log.info("Building the data structure")

+         delta = times["data structure end"] - times["start"]

+         _log.info("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

  

-             _log.debug("Building the FAS cache")

-             delta = times["FAS cache building end"] - times["data structure end"]

-             _log.debug("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

+         _log.info("Building the FAS cache")

+         delta = times["FAS cache building end"] - times["data structure end"]

+         _log.info("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

  

-             _log.debug("Building the bugzilla cache")

-             delta = times["BZ cache building end"] - times["FAS cache building end"]

-             _log.debug("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

+         _log.info("Building the bugzilla cache")

+         delta = times["BZ cache building end"] - times["FAS cache building end"]

+         _log.info("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

  

-             _log.debug("Interacting with bugzilla")

-             delta = times["end"] - times["BZ cache building end"]

-             _log.debug("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

+         _log.info("Interacting with bugzilla")

+         delta = times["end"] - times["BZ cache building end"]

+         _log.info("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

  

-             _log.debug("Total")

-             delta = times["end"] - times["start"]

-             _log.debug("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

+         _log.info("Total")

+         delta = times["end"] - times["start"]

+         _log.info("  Ran on %2f seconds -- ie: %2f minutes", delta, delta / 60)

  

      def _get_pagure_projects(

          self, dist_git_url: str, project_list: list = None

file modified
+106 -110
@@ -226,26 +226,26 @@ 

  

      for bug in query_results:

          if bug.assigned_to == old_poc and bug.assigned_to != new_poc:

-             if _log.isEnabledFor(logging.DEBUG):

-                 temp_old_poc = bug.assigned_to

-                 temp_new_poc = new_poc

-                 if print_fas_names:

-                     if temp_old_poc in fas_users_info:

-                         temp_old_poc = fas_users_info[old_poc]

-                     else:

-                         temp_old_poc = old_poc.split("@", 1)[0] + "@..."

-                     if temp_new_poc in fas_users_info:

-                         temp_new_poc = fas_users_info[new_poc]

-                     else:

-                         temp_new_poc = new_poc.split("@", 1)[0] + "@..."

-                 _log.debug(

-                     "%s/%s reassigning bug #%s from %s to %s",

-                     product,

-                     package,

-                     bug.bug_id,

-                     temp_old_poc,

-                     temp_new_poc,

-                 )

+ 

+             temp_old_poc = bug.assigned_to

+             temp_new_poc = new_poc

+             if print_fas_names:

+                 if temp_old_poc in fas_users_info:

+                     temp_old_poc = fas_users_info[old_poc]

+                 else:

+                     temp_old_poc = old_poc.split("@", 1)[0] + "@..."

+                 if temp_new_poc in fas_users_info:

+                     temp_new_poc = fas_users_info[new_poc]

+                 else:

+                     temp_new_poc = new_poc.split("@", 1)[0] + "@..."

+             _log.info(

+                 "%s/%s reassigning bug #%s from %s to %s",

+                 product,

+                 package,

+                 bug.bug_id,

+                 temp_old_poc,

+                 temp_new_poc,

+             )

  

              if not dry_run:

                  try:
@@ -304,7 +304,7 @@ 

      """

      server = get_bz()

      if retired:

-         _log.debug("[NOADD] %s/%s is retired", product, package)

+         _log.info("[NOADD] %s/%s is retired", product, package)

          return

  

      data = {
@@ -318,47 +318,44 @@ 

      if cc_list:

          data["initialcclist"] = cc_list

  

-     if _log.isEnabledFor(logging.DEBUG):

-         for key in [

+     for key in [

+         "initialowner",

+         "description",

+         "initialqacontact",

+         "initialcclist",

+         "is_active",

+     ]:

+         if print_fas_names and key in [

              "initialowner",

-             "description",

              "initialqacontact",

              "initialcclist",

-             "is_active",

          ]:

-             if print_fas_names and key in [

-                 "initialowner",

-                 "initialqacontact",

-                 "initialcclist",

-             ]:

-                 if key == "initialowner":

-                     # Print bugzilla e-mail if FAS name is not found

-                     # This shouldn't happen, but to be safe

-                     value = fas_users_info.get(owner, owner)

- 

-                 if key == "initialqacontact":

-                     # Print bugzilla e-mail if FAS name is not found

-                     # This shouldn't happen, but to be safe

-                     value = fas_users_info.get(qa_contact, qa_contact)

- 

-                 if key == "initialcclist":

-                     # Print bugzilla e-mail if FAS name is not found

-                     # This shouldn't happen, but to be safe

-                     value = [

-                         fas_users_info.get(cc_user, cc_user) for cc_user in cc_list

-                     ]

- 

-                 _log.debug(

-                     "[ADDCOMP] %s/%s %s set to FAS name(s) `%s`",

-                     product,

-                     package,

-                     key,

-                     value,

-                 )

-             else:

-                 _log.debug(

-                     "[ADDCOMP] %s/%s %s set to `%s`", product, package, key, data[key]

-                 )

+             if key == "initialowner":

+                 # Print bugzilla e-mail if FAS name is not found

+                 # This shouldn't happen, but to be safe

+                 value = fas_users_info.get(owner, owner)

+ 

+             if key == "initialqacontact":

+                 # Print bugzilla e-mail if FAS name is not found

+                 # This shouldn't happen, but to be safe

+                 value = fas_users_info.get(qa_contact, qa_contact)

+ 

+             if key == "initialcclist":

+                 # Print bugzilla e-mail if FAS name is not found

+                 # This shouldn't happen, but to be safe

+                 value = [fas_users_info.get(cc_user, cc_user) for cc_user in cc_list]

+ 

+             _log.info(

+                 "[ADDCOMP] %s/%s %s set to FAS name(s) `%s`",

+                 product,

+                 package,

+                 key,

+                 value,

+             )

+         else:

+             _log.info(

+                 "[ADDCOMP] %s/%s %s set to `%s`", product, package, key, data[key]

+             )

  

      if not dry_run:

          try:
@@ -449,68 +446,67 @@ 

          data["product"] = product

          data["component"] = package

  

-         if _log.isEnabledFor(logging.DEBUG):

-             for key in [

+         for key in [

+             "initialowner",

+             "description",

+             "initialqacontact",

+             "initialcclist",

+             "is_active",

+         ]:

+             if data.get(key) is not None:

+                 old_value = component[key]

+                 if isinstance(old_value, list):

+                     old_value = sorted(old_value)

+                 new_value = data.get(key)

+                 if isinstance(new_value, list):

+                     new_value = sorted(new_value)

+ 

+             if print_fas_names and key in [

                  "initialowner",

-                 "description",

                  "initialqacontact",

                  "initialcclist",

-                 "is_active",

              ]:

+                 if key == "initialowner":

+                     # Print bugzilla e-mail if FAS name is not found

+                     # This shouldn't happen, but to be safe

+                     old_value = fas_users_info.get(component[key], component[key])

+                     new_value = fas_users_info.get(owner, owner)

+ 

+                 if key == "initialqacontact":

+                     # Print bugzilla e-mail if FAS name is not found

+                     # This shouldn't happen, but to be safe

+                     old_value = fas_users_info.get(component[key], component[key])

+                     new_value = fas_users_info.get(qa_contact, qa_contact)

+ 

+                 if key == "initialcclist":

+                     # Print bugzilla e-mail if FAS name is not found

+                     # This shouldn't happen, but to be safe

+                     old_value = [

+                         fas_users_info.get(cc_user, cc_user)

+                         for cc_user in component[key]

+                     ]

+                     new_value = [

+                         fas_users_info.get(cc_user, cc_user) for cc_user in cc_list

+                     ]

+ 

+                 _log.info(

+                     "[EDITCOMP] %s/%s %s changed from `%s` to FAS name(s) `%s`",

+                     product,

+                     package,

+                     key,

+                     old_value,

+                     new_value,

+                 )

+             else:

                  if data.get(key) is not None:

-                     old_value = component[key]

-                     if isinstance(old_value, list):

-                         old_value = sorted(old_value)

-                     new_value = data.get(key)

-                     if isinstance(new_value, list):

-                         new_value = sorted(new_value)

- 

-                 if print_fas_names and key in [

-                     "initialowner",

-                     "initialqacontact",

-                     "initialcclist",

-                 ]:

-                     if key == "initialowner":

-                         # Print bugzilla e-mail if FAS name is not found

-                         # This shouldn't happen, but to be safe

-                         old_value = fas_users_info.get(component[key], component[key])

-                         new_value = fas_users_info.get(owner, owner)

- 

-                     if key == "initialqacontact":

-                         # Print bugzilla e-mail if FAS name is not found

-                         # This shouldn't happen, but to be safe

-                         old_value = fas_users_info.get(component[key], component[key])

-                         new_value = fas_users_info.get(qa_contact, qa_contact)

- 

-                     if key == "initialcclist":

-                         # Print bugzilla e-mail if FAS name is not found

-                         # This shouldn't happen, but to be safe

-                         old_value = [

-                             fas_users_info.get(cc_user, cc_user)

-                             for cc_user in component[key]

-                         ]

-                         new_value = [

-                             fas_users_info.get(cc_user, cc_user) for cc_user in cc_list

-                         ]

- 

-                     _log.debug(

-                         "[EDITCOMP] %s/%s %s changed from `%s` to FAS name(s) `%s`",

+                     _log.info(

+                         "[EDITCOMP] %s/%s %s changed from `%s` to `%s`",

                          product,

                          package,

                          key,

                          old_value,

                          new_value,

                      )

-                 else:

-                     if data.get(key) is not None:

-                         _log.debug(

-                             "[EDITCOMP] %s/%s %s changed from `%s` to `%s`",

-                             product,

-                             package,

-                             key,

-                             old_value,

-                             new_value,

-                         )

          owner_changed = "initialowner" in data

  

          # FIXME: initialowner has been made mandatory for some
@@ -542,7 +538,7 @@ 

  

      else:

          if print_no_change:

-             _log.debug("[NOCHANGE] %s/%s", product, package)

+             _log.info("[NOCHANGE] %s/%s", product, package)

  

  

  def execute_bugzilla_call(

no initial comment

rebased onto 6b1d864

3 years ago

rebased onto 85309aa

3 years ago

rebased onto 85309aa

3 years ago

Pull-Request has been merged by zlopez

3 years ago