#48 Disable in bugzilla components that are retired in Fedora
Merged 3 years ago by nphilipp. Opened 3 years ago by pingou.
fedora-infra/ pingou/distgit-bugzilla-sync disable_retired  into  master

@@ -215,6 +215,7 @@ 

                              'description': package['description'],

                              'initialqacontact': package['default_qa_contact'],

                              'initialcclist': package['default_cc'],

+                             'is_active': package['is_active'],

                          }

                          product_info_by_pkg[package['name'].lower()] = product_info

                  self.product_cache[collection] = product_info_by_pkg
@@ -397,21 +398,23 @@ 

                          data['initialcclist'] = initial_cc_emails

                          break

  

+             if product[pkg_key]['is_active'] != (not retired):

+                 data['is_active'] = not retired

+ 

              if data:

                  # Changes occurred.  Submit a request to change via xmlrpc

                  data['product'] = bz_product_name

                  data['component'] = package

-                 data["is_active"] = not retired

  

                  if self.config["verbose"]:

-                     for key in ["initialowner", "description", "initialqacontact", "initialcclist"]:

-                         if data.get(key):

+                     for key in ["initialowner", "description", "initialqacontact", "initialcclist", "is_active"]:

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

  

                              old_value = product[pkg_key][key]

-                             if not isinstance(old_value, str):

+                             if isinstance(old_value, list):

                                  old_value = sorted(old_value)

                              new_value = data.get(key)

-                             if not isinstance(new_value, str):

+                             if isinstance(new_value, list):

                                  new_value = sorted(new_value)

  

                              if print_fas_names and key in ('initialowner',

This way components that are retired in Fedora will not get any new bug
report.

Fixes https://pagure.io/fedora-infrastructure/issue/7639

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

Without this:

$ ./run-distgit-bugzilla-sync --add-config-file configuration.toml --dry-run --debug -p rpms/libprojectM-qt  --print-no-change
[...]
1 projects to consider
Building bugzilla's products in-memory cache
  - Querying product `Fedora`, query 1 of 1
Querying bugzilla but not doing anything
[NOCHANGE] libprojectM-qt/Fedora

With this:

$ ./run-distgit-bugzilla-sync --add-config-file configuration.toml --dry-run --debug -p rpms/libprojectM-qt  --print-no-change
[...]
1 projects to consider
Building bugzilla's products in-memory cache
  - Querying product `Fedora`, query 1 of 1
Querying bugzilla but not doing anything
[EDITCOMP] Fedora/libprojectM-qt  is_active changed from `True` to `False`

Metadata Update from @nphilipp:
- Request assigned

3 years ago

The conditionals look backwards to me, how about this?

        if isinstance(old_value, list):
            ...
        if isinstance(new_value, list):
            ...

Yeah the issue is that list, tuple and set could be sorted, so the code tries to be "smart" here, but since it's not a library we don't have to be smart, so :thumbsup:

rebased onto abf7b7f

3 years ago

Pull-Request has been merged by nphilipp

3 years ago
Metadata