| |
@@ -234,6 +234,45 @@
|
| |
bz_email = email_overrides.get(bz_email, bz_email)
|
| |
return bz_email
|
| |
|
| |
+ def update_open_bugs(self, new_poc, prev_poc, product, name):
|
| |
+ '''Change the package owner
|
| |
+ :arg new_poc: email of the new point of contact.
|
| |
+ :arg prev_poc: Username of the previous point of contact
|
| |
+ :arg product: The product of the package to change in bugzilla
|
| |
+ :arg name: Name of the package to change the owner.
|
| |
+ '''
|
| |
+ bz_query = {}
|
| |
+ bz_query['product'] = product
|
| |
+ bz_query['component'] = name
|
| |
+ bz_query['bug_status'] = [
|
| |
+ 'NEW', 'ASSIGNED', 'ON_DEV', 'ON_QA', 'MODIFIED', 'POST',
|
| |
+ 'FAILS_QA', 'PASSES_QA', 'RELEASE_PENDING']
|
| |
+ # Update only maintained releases
|
| |
+ bz_query['version'] = self.config["products_versions"][product]
|
| |
+
|
| |
+ query_results = self.server.query(bz_query)
|
| |
+
|
| |
+ for bug in query_results:
|
| |
+ if bug.assigned_to == prev_poc and bug.assigned_to != new_poc:
|
| |
+ if self.config["verbose"]:
|
| |
+ print(
|
| |
+ f' - reassigning bug #{bug.bug_id} '
|
| |
+ f'from {bug.assigned_to} to {new_poc}'
|
| |
+ )
|
| |
+ if not self.config["dryrun"]:
|
| |
+ try:
|
| |
+ bug.setassignee(
|
| |
+ assigned_to=new_poc,
|
| |
+ comment=self.config['bz_maintainer_change_comment'],
|
| |
+ )
|
| |
+ except xmlrpc.client.Fault as e:
|
| |
+ # Output something useful in args
|
| |
+ e.args = (data, e.faultCode, e.faultString)
|
| |
+ raise
|
| |
+ except xmlrpc.client.ProtocolError as e:
|
| |
+ e.args = ('ProtocolError', e.errcode, e.errmsg)
|
| |
+ raise
|
| |
+
|
| |
def add_edit_component(self, package, collection, owner, description=None,
|
| |
qacontact=None, cclist=None, print_fas_names=False):
|
| |
'''Add or update a component to have the values specified.
|
| |
@@ -344,6 +383,8 @@
|
| |
else:
|
| |
print(f" {key} changed from `{old_value}` to `{new_value}`")
|
| |
|
| |
+ owner_changed = "initialowner" in data
|
| |
+
|
| |
# FIXME: initialowner has been made mandatory for some
|
| |
# reason. Asking dkl why.
|
| |
data['initialowner'] = owner_email
|
| |
@@ -357,6 +398,13 @@
|
| |
except xmlrpc.client.ProtocolError as e:
|
| |
e.args = ('ProtocolError', e.errcode, e.errmsg)
|
| |
raise
|
| |
+ if owner_changed:
|
| |
+ self.update_open_bugs(
|
| |
+ new_poc=owner_email,
|
| |
+ prev_poc=product[pkg_key]['initialowner'],
|
| |
+ name=package,
|
| |
+ product=self.config['products'][collection],
|
| |
+ )
|
| |
else:
|
| |
if self.config.get("print-no-change"):
|
| |
print(f"[NOCHANGE] {package}/{self.config['products'][collection]}")
|
| |
When a package change default assignee, go over all the open bugs and change their assignee as well.
Fixes https://pagure.io/fedora-infrastructure/issue/6940
This PR also contains a fix in the default configuration file. It seems multi-line strings should have a new line character just after the opening
"""
.